/* Application.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from Application.vala, do not modify */

/*
 *  Copyright 2019 elementary, Inc. (https://elementary.io)
 *
 *  This program or library is free software; you can redistribute it
 *  and/or modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 3 of the License, or (at your option) any later version.
 *
 *  This library 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
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General
 *  Public License along with this library; if not, write to the
 *  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 *  Boston, MA 02110-1301 USA.
 */

#include <glib-object.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include "granite-7.h"
#include <float.h>
#include <math.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

#define GRANITE_SERVICES_APPLICATION_TYPE_UNITY_LAUNCHER_ENTRY (granite_services_application_unity_launcher_entry_get_type ())
#define GRANITE_SERVICES_APPLICATION_UNITY_LAUNCHER_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GRANITE_SERVICES_APPLICATION_TYPE_UNITY_LAUNCHER_ENTRY, GraniteServicesApplicationUnityLauncherEntry))
#define GRANITE_SERVICES_APPLICATION_UNITY_LAUNCHER_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GRANITE_SERVICES_APPLICATION_TYPE_UNITY_LAUNCHER_ENTRY, GraniteServicesApplicationUnityLauncherEntryClass))
#define GRANITE_SERVICES_APPLICATION_IS_UNITY_LAUNCHER_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GRANITE_SERVICES_APPLICATION_TYPE_UNITY_LAUNCHER_ENTRY))
#define GRANITE_SERVICES_APPLICATION_IS_UNITY_LAUNCHER_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GRANITE_SERVICES_APPLICATION_TYPE_UNITY_LAUNCHER_ENTRY))
#define GRANITE_SERVICES_APPLICATION_UNITY_LAUNCHER_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GRANITE_SERVICES_APPLICATION_TYPE_UNITY_LAUNCHER_ENTRY, GraniteServicesApplicationUnityLauncherEntryClass))

typedef struct _GraniteServicesApplicationUnityLauncherEntry GraniteServicesApplicationUnityLauncherEntry;
typedef struct _GraniteServicesApplicationUnityLauncherEntryClass GraniteServicesApplicationUnityLauncherEntryClass;
typedef struct _GraniteServicesApplicationUnityLauncherEntryPrivate GraniteServicesApplicationUnityLauncherEntryPrivate;
enum  {
	GRANITE_SERVICES_APPLICATION_UNITY_LAUNCHER_ENTRY_0_PROPERTY,
	GRANITE_SERVICES_APPLICATION_UNITY_LAUNCHER_ENTRY_NUM_PROPERTIES
};
static GParamSpec* granite_services_application_unity_launcher_entry_properties[GRANITE_SERVICES_APPLICATION_UNITY_LAUNCHER_ENTRY_NUM_PROPERTIES];

#define GRANITE_SERVICES_TYPE_ASYNC_MUTEX (granite_services_async_mutex_get_type ())
#define GRANITE_SERVICES_ASYNC_MUTEX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GRANITE_SERVICES_TYPE_ASYNC_MUTEX, GraniteServicesAsyncMutex))
#define GRANITE_SERVICES_ASYNC_MUTEX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GRANITE_SERVICES_TYPE_ASYNC_MUTEX, GraniteServicesAsyncMutexClass))
#define GRANITE_SERVICES_IS_ASYNC_MUTEX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GRANITE_SERVICES_TYPE_ASYNC_MUTEX))
#define GRANITE_SERVICES_IS_ASYNC_MUTEX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GRANITE_SERVICES_TYPE_ASYNC_MUTEX))
#define GRANITE_SERVICES_ASYNC_MUTEX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GRANITE_SERVICES_TYPE_ASYNC_MUTEX, GraniteServicesAsyncMutexClass))

typedef struct _GraniteServicesAsyncMutex GraniteServicesAsyncMutex;
typedef struct _GraniteServicesAsyncMutexClass GraniteServicesAsyncMutexClass;
#define _granite_services_async_mutex_unref0(var) ((var == NULL) ? NULL : (var = (granite_services_async_mutex_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _GraniteServicesApplicationUnityLauncherEntryGetInstanceData GraniteServicesApplicationUnityLauncherEntryGetInstanceData;
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
enum  {
	GRANITE_SERVICES_APPLICATION_UNITY_LAUNCHER_ENTRY_UPDATE_SIGNAL,
	GRANITE_SERVICES_APPLICATION_UNITY_LAUNCHER_ENTRY_NUM_SIGNALS
};
static guint granite_services_application_unity_launcher_entry_signals[GRANITE_SERVICES_APPLICATION_UNITY_LAUNCHER_ENTRY_NUM_SIGNALS] = {0};
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
typedef struct _GraniteServicesApplicationSetBadgeData GraniteServicesApplicationSetBadgeData;
typedef struct _GraniteServicesApplicationSetBadgeVisibleData GraniteServicesApplicationSetBadgeVisibleData;
typedef struct _GraniteServicesApplicationSetProgressData GraniteServicesApplicationSetProgressData;
typedef struct _GraniteServicesApplicationSetProgressVisibleData GraniteServicesApplicationSetProgressVisibleData;

struct _GraniteServicesApplicationUnityLauncherEntry {
	GObject parent_instance;
	GraniteServicesApplicationUnityLauncherEntryPrivate * priv;
};

struct _GraniteServicesApplicationUnityLauncherEntryClass {
	GObjectClass parent_class;
};

struct _GraniteServicesApplicationUnityLauncherEntryPrivate {
	gchar* app_uri;
	GHashTable* properties;
};

struct _GraniteServicesApplicationUnityLauncherEntryGetInstanceData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GraniteServicesApplicationUnityLauncherEntry* result;
	GraniteServicesAsyncMutex* _tmp0_;
	GraniteServicesAsyncMutex* _tmp1_;
	GraniteServicesAsyncMutex* _tmp2_;
	GraniteServicesApplicationUnityLauncherEntry* _tmp3_;
	GraniteServicesAsyncMutex* _tmp4_;
	GraniteServicesApplicationUnityLauncherEntry* _tmp5_;
	GApplication* app;
	GApplication* _tmp6_;
	GApplication* _tmp7_;
	GraniteServicesAsyncMutex* _tmp8_;
	GError* _tmp9_;
	GApplication* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	GraniteServicesAsyncMutex* _tmp13_;
	GError* _tmp14_;
	GraniteServicesApplicationUnityLauncherEntry* local_instance;
	GraniteServicesApplicationUnityLauncherEntry* _tmp15_;
	GraniteServicesApplicationUnityLauncherEntry* _tmp16_;
	GApplication* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	gchar* _tmp20_;
	char* object_path;
	GraniteServicesApplicationUnityLauncherEntry* _tmp21_;
	const gchar* _tmp22_;
	gchar* _tmp23_;
	gchar* _tmp24_;
	char* _tmp25_;
	char* _tmp26_;
	GDBusConnection* session_connection;
	GDBusConnection* _tmp27_;
	GDBusConnection* _tmp28_;
	const char* _tmp29_;
	GraniteServicesApplicationUnityLauncherEntry* _tmp30_;
	GraniteServicesApplicationUnityLauncherEntry* _tmp31_;
	GraniteServicesApplicationUnityLauncherEntry* _tmp32_;
	GError* e;
	GraniteServicesAsyncMutex* _tmp33_;
	GError* _tmp34_;
	GError* _tmp35_;
	GraniteServicesAsyncMutex* _tmp36_;
	GraniteServicesApplicationUnityLauncherEntry* _tmp37_;
	GError* _inner_error0_;
};

struct _GraniteServicesApplicationSetBadgeData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	gint64 count;
	gboolean result;
	GraniteServicesApplicationUnityLauncherEntry* instance;
	GraniteServicesApplicationUnityLauncherEntry* _tmp0_;
	GVariant* _tmp1_;
	GVariant* _tmp2_;
	GError* _inner_error0_;
};

struct _GraniteServicesApplicationSetBadgeVisibleData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	gboolean visible;
	gboolean result;
	GraniteServicesApplicationUnityLauncherEntry* instance;
	GraniteServicesApplicationUnityLauncherEntry* _tmp0_;
	GVariant* _tmp1_;
	GVariant* _tmp2_;
	GError* _inner_error0_;
};

struct _GraniteServicesApplicationSetProgressData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	gdouble progress;
	gboolean result;
	GraniteServicesApplicationUnityLauncherEntry* instance;
	GraniteServicesApplicationUnityLauncherEntry* _tmp0_;
	GVariant* _tmp1_;
	GVariant* _tmp2_;
	GError* _inner_error0_;
};

struct _GraniteServicesApplicationSetProgressVisibleData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	gboolean visible;
	gboolean result;
	GraniteServicesApplicationUnityLauncherEntry* instance;
	GraniteServicesApplicationUnityLauncherEntry* _tmp0_;
	GVariant* _tmp1_;
	GVariant* _tmp2_;
	GError* _inner_error0_;
};

static gint GraniteServicesApplicationUnityLauncherEntry_private_offset;
static gpointer granite_services_application_unity_launcher_entry_parent_class = NULL;
static GraniteServicesAsyncMutex* granite_services_application_unity_launcher_entry_instance_mutex;
static GraniteServicesAsyncMutex* granite_services_application_unity_launcher_entry_instance_mutex = NULL;
static GraniteServicesApplicationUnityLauncherEntry* granite_services_application_unity_launcher_entry_instance;
static GraniteServicesApplicationUnityLauncherEntry* granite_services_application_unity_launcher_entry_instance = NULL;

 G_GNUC_INTERNAL GType granite_services_application_unity_launcher_entry_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
 G_GNUC_INTERNAL guint granite_services_application_unity_launcher_entry_register_object (void* object,
                                                                         GDBusConnection* connection,
                                                                         const gchar* path,
                                                                         GError** error);
 G_GNUC_INTERNAL gpointer granite_services_async_mutex_ref (gpointer instance);
 G_GNUC_INTERNAL void granite_services_async_mutex_unref (gpointer instance);
 G_GNUC_INTERNAL GParamSpec* granite_services_param_spec_async_mutex (const gchar* name,
                                                     const gchar* nick,
                                                     const gchar* blurb,
                                                     GType object_type,
                                                     GParamFlags flags);
 G_GNUC_INTERNAL void granite_services_value_set_async_mutex (GValue* value,
                                             gpointer v_object) G_GNUC_UNUSED ;
 G_GNUC_INTERNAL void granite_services_value_take_async_mutex (GValue* value,
                                              gpointer v_object);
 G_GNUC_INTERNAL gpointer granite_services_value_get_async_mutex (const GValue* value) G_GNUC_UNUSED ;
 G_GNUC_INTERNAL GType granite_services_async_mutex_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static void granite_services_application_unity_launcher_entry_get_instance_data_free (gpointer _data);
 G_GNUC_INTERNAL void granite_services_application_unity_launcher_entry_get_instance (GAsyncReadyCallback _callback_,
                                                                     gpointer _user_data_);
 G_GNUC_INTERNAL GraniteServicesApplicationUnityLauncherEntry* granite_services_application_unity_launcher_entry_get_instance_finish (GAsyncResult* _res_,
                                                                                                                     GError** error);
static gboolean granite_services_application_unity_launcher_entry_get_instance_co (GraniteServicesApplicationUnityLauncherEntryGetInstanceData* _data_);
 G_GNUC_INTERNAL GraniteServicesAsyncMutex* granite_services_async_mutex_new (void);
 G_GNUC_INTERNAL GraniteServicesAsyncMutex* granite_services_async_mutex_construct (GType object_type);
 G_GNUC_INTERNAL void granite_services_async_mutex_lock (GraniteServicesAsyncMutex* self,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
 G_GNUC_INTERNAL void granite_services_async_mutex_lock_finish (GraniteServicesAsyncMutex* self,
                                               GAsyncResult* _res_);
static void granite_services_application_unity_launcher_entry_get_instance_ready (GObject* source_object,
                                                                           GAsyncResult* _res_,
                                                                           gpointer _user_data_);
 G_GNUC_INTERNAL void granite_services_async_mutex_unlock (GraniteServicesAsyncMutex* self);
 G_GNUC_INTERNAL GraniteServicesApplicationUnityLauncherEntry* granite_services_application_unity_launcher_entry_new (void);
 G_GNUC_INTERNAL GraniteServicesApplicationUnityLauncherEntry* granite_services_application_unity_launcher_entry_construct (GType object_type);
 G_GNUC_INTERNAL void granite_services_application_unity_launcher_entry_set_app_property (GraniteServicesApplicationUnityLauncherEntry* self,
                                                                         const gchar* property,
                                                                         GVariant* var);
static void _g_free0_ (gpointer var);
static void _g_variant_unref0_ (gpointer var);
static void g_cclosure_user_marshal_VOID__STRING_BOXED (GClosure * closure,
                                                 GValue * return_value,
                                                 guint n_param_values,
                                                 const GValue * param_values,
                                                 gpointer invocation_hint,
                                                 gpointer marshal_data);
 G_GNUC_INTERNAL GHashTable* granite_services_application_unity_launcher_entry_query (GraniteServicesApplicationUnityLauncherEntry* self,
                                                                     GError** error);
static GObject * granite_services_application_unity_launcher_entry_constructor (GType type,
                                                                         guint n_construct_properties,
                                                                         GObjectConstructParam * construct_properties);
static void granite_services_application_unity_launcher_entry_finalize (GObject * obj);
static GType granite_services_application_unity_launcher_entry_get_type_once (void);
static void _dbus_granite_services_application_unity_launcher_entry_query (GraniteServicesApplicationUnityLauncherEntry* self,
                                                                    GVariant* _parameters_,
                                                                    GDBusMethodInvocation* invocation);
static void granite_services_application_unity_launcher_entry_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* granite_services_application_unity_launcher_entry_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 granite_services_application_unity_launcher_entry_dbus_interface_set_property (GDBusConnection* connection,
                                                                                        const gchar* sender,
                                                                                        const gchar* object_path,
                                                                                        const gchar* interface_name,
                                                                                        const gchar* property_name,
                                                                                        GVariant* value,
                                                                                        GError** error,
                                                                                        gpointer user_data);
static void _dbus_granite_services_application_unity_launcher_entry_update (GObject* _sender,
                                                                     const gchar* app_uri,
                                                                     GHashTable* properties,
                                                                     gpointer* _data);
static void _granite_services_application_unity_launcher_entry_unregister_object (gpointer user_data);
static void granite_services_application_set_badge_data_free (gpointer _data);
static gboolean granite_services_application_set_badge_co (GraniteServicesApplicationSetBadgeData* _data_);
static void granite_services_application_set_badge_ready (GObject* source_object,
                                                   GAsyncResult* _res_,
                                                   gpointer _user_data_);
static void granite_services_application_set_badge_visible_data_free (gpointer _data);
static gboolean granite_services_application_set_badge_visible_co (GraniteServicesApplicationSetBadgeVisibleData* _data_);
static void granite_services_application_set_badge_visible_ready (GObject* source_object,
                                                           GAsyncResult* _res_,
                                                           gpointer _user_data_);
static void granite_services_application_set_progress_data_free (gpointer _data);
static gboolean granite_services_application_set_progress_co (GraniteServicesApplicationSetProgressData* _data_);
static void granite_services_application_set_progress_ready (GObject* source_object,
                                                      GAsyncResult* _res_,
                                                      gpointer _user_data_);
static void granite_services_application_set_progress_visible_data_free (gpointer _data);
static gboolean granite_services_application_set_progress_visible_co (GraniteServicesApplicationSetProgressVisibleData* _data_);
static void granite_services_application_set_progress_visible_ready (GObject* source_object,
                                                              GAsyncResult* _res_,
                                                              gpointer _user_data_);

static const GDBusArgInfo _granite_services_application_unity_launcher_entry_dbus_arg_info_query_result = {-1, "result", "a{sv}", NULL};
static const GDBusArgInfo * const _granite_services_application_unity_launcher_entry_dbus_arg_info_query_in[] = {NULL};
static const GDBusArgInfo * const _granite_services_application_unity_launcher_entry_dbus_arg_info_query_out[] = {&_granite_services_application_unity_launcher_entry_dbus_arg_info_query_result, NULL};
static const GDBusMethodInfo _granite_services_application_unity_launcher_entry_dbus_method_info_query = {-1, "Query", (GDBusArgInfo **) (&_granite_services_application_unity_launcher_entry_dbus_arg_info_query_in), (GDBusArgInfo **) (&_granite_services_application_unity_launcher_entry_dbus_arg_info_query_out), NULL};
static const GDBusMethodInfo * const _granite_services_application_unity_launcher_entry_dbus_method_info[] = {&_granite_services_application_unity_launcher_entry_dbus_method_info_query, NULL};
static const GDBusArgInfo _granite_services_application_unity_launcher_entry_dbus_arg_info_update_app_uri = {-1, "app_uri", "s", NULL};
static const GDBusArgInfo _granite_services_application_unity_launcher_entry_dbus_arg_info_update_properties = {-1, "properties", "a{sv}", NULL};
static const GDBusArgInfo * const _granite_services_application_unity_launcher_entry_dbus_arg_info_update[] = {&_granite_services_application_unity_launcher_entry_dbus_arg_info_update_app_uri, &_granite_services_application_unity_launcher_entry_dbus_arg_info_update_properties, NULL};
static const GDBusSignalInfo _granite_services_application_unity_launcher_entry_dbus_signal_info_update = {-1, "Update", (GDBusArgInfo **) (&_granite_services_application_unity_launcher_entry_dbus_arg_info_update), NULL};
static const GDBusSignalInfo * const _granite_services_application_unity_launcher_entry_dbus_signal_info[] = {&_granite_services_application_unity_launcher_entry_dbus_signal_info_update, NULL};
static const GDBusPropertyInfo * const _granite_services_application_unity_launcher_entry_dbus_property_info[] = {NULL};
static const GDBusInterfaceInfo _granite_services_application_unity_launcher_entry_dbus_interface_info = {-1, "com.canonical.Unity.LauncherEntry", (GDBusMethodInfo **) (&_granite_services_application_unity_launcher_entry_dbus_method_info), (GDBusSignalInfo **) (&_granite_services_application_unity_launcher_entry_dbus_signal_info), (GDBusPropertyInfo **) (&_granite_services_application_unity_launcher_entry_dbus_property_info), NULL};
static const GDBusInterfaceVTable _granite_services_application_unity_launcher_entry_dbus_interface_vtable = {granite_services_application_unity_launcher_entry_dbus_interface_method_call, granite_services_application_unity_launcher_entry_dbus_interface_get_property, granite_services_application_unity_launcher_entry_dbus_interface_set_property};

static inline gpointer
granite_services_application_unity_launcher_entry_get_instance_private (GraniteServicesApplicationUnityLauncherEntry* self)
{
	return G_STRUCT_MEMBER_P (self, GraniteServicesApplicationUnityLauncherEntry_private_offset);
}

static void
granite_services_application_unity_launcher_entry_get_instance_data_free (gpointer _data)
{
	GraniteServicesApplicationUnityLauncherEntryGetInstanceData* _data_;
	_data_ = _data;
	g_slice_free (GraniteServicesApplicationUnityLauncherEntryGetInstanceData, _data_);
}

 G_GNUC_INTERNAL void
granite_services_application_unity_launcher_entry_get_instance (GAsyncReadyCallback _callback_,
                                                                gpointer _user_data_)
{
	GraniteServicesApplicationUnityLauncherEntryGetInstanceData* _data_;
	_data_ = g_slice_new0 (GraniteServicesApplicationUnityLauncherEntryGetInstanceData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, granite_services_application_unity_launcher_entry_get_instance_data_free);
	granite_services_application_unity_launcher_entry_get_instance_co (_data_);
}

 G_GNUC_INTERNAL GraniteServicesApplicationUnityLauncherEntry*
granite_services_application_unity_launcher_entry_get_instance_finish (GAsyncResult* _res_,
                                                                       GError** error)
{
	GraniteServicesApplicationUnityLauncherEntry* result;
	GraniteServicesApplicationUnityLauncherEntryGetInstanceData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
granite_services_application_unity_launcher_entry_get_instance_ready (GObject* source_object,
                                                                      GAsyncResult* _res_,
                                                                      gpointer _user_data_)
{
	GraniteServicesApplicationUnityLauncherEntryGetInstanceData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	granite_services_application_unity_launcher_entry_get_instance_co (_data_);
}

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

static gpointer
_g_error_copy0 (gpointer self)
{
	return self ? g_error_copy (self) : NULL;
}

static gboolean
granite_services_application_unity_launcher_entry_get_instance_co (GraniteServicesApplicationUnityLauncherEntryGetInstanceData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = granite_services_application_unity_launcher_entry_instance_mutex;
	if (_data_->_tmp0_ == NULL) {
		_data_->_tmp1_ = granite_services_async_mutex_new ();
		_granite_services_async_mutex_unref0 (granite_services_application_unity_launcher_entry_instance_mutex);
		granite_services_application_unity_launcher_entry_instance_mutex = _data_->_tmp1_;
	}
	_data_->_tmp2_ = granite_services_application_unity_launcher_entry_instance_mutex;
	_data_->_state_ = 1;
	granite_services_async_mutex_lock (_data_->_tmp2_, granite_services_application_unity_launcher_entry_get_instance_ready, _data_);
	return FALSE;
	_state_1:
	granite_services_async_mutex_lock_finish (_data_->_tmp2_, _data_->_res_);
	_data_->_tmp3_ = granite_services_application_unity_launcher_entry_instance;
	if (_data_->_tmp3_ != NULL) {
		_data_->_tmp4_ = granite_services_application_unity_launcher_entry_instance_mutex;
		granite_services_async_mutex_unlock (_data_->_tmp4_);
		_data_->_tmp5_ = granite_services_application_unity_launcher_entry_instance;
		_data_->result = _data_->_tmp5_;
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp6_ = g_application_get_default ();
	_data_->app = _data_->_tmp6_;
	_data_->_tmp7_ = _data_->app;
	if (_data_->_tmp7_ == NULL) {
		_data_->_tmp8_ = granite_services_application_unity_launcher_entry_instance_mutex;
		granite_services_async_mutex_unlock (_data_->_tmp8_);
		_data_->_tmp9_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, "No GApplication has been defined");
		_data_->_inner_error0_ = _data_->_tmp9_;
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp10_ = _data_->app;
	_data_->_tmp11_ = g_application_get_application_id (_data_->_tmp10_);
	_data_->_tmp12_ = _data_->_tmp11_;
	if (_data_->_tmp12_ == NULL) {
		_data_->_tmp13_ = granite_services_application_unity_launcher_entry_instance_mutex;
		granite_services_async_mutex_unlock (_data_->_tmp13_);
		_data_->_tmp14_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, "The GApplication has no application-id defined");
		_data_->_inner_error0_ = _data_->_tmp14_;
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp15_ = granite_services_application_unity_launcher_entry_new ();
	_data_->local_instance = _data_->_tmp15_;
	_data_->_tmp16_ = _data_->local_instance;
	_data_->_tmp17_ = _data_->app;
	_data_->_tmp18_ = g_application_get_application_id (_data_->_tmp17_);
	_data_->_tmp19_ = _data_->_tmp18_;
	_data_->_tmp20_ = g_strdup_printf ("application://%s.desktop", _data_->_tmp19_);
	_g_free0 (_data_->_tmp16_->priv->app_uri);
	_data_->_tmp16_->priv->app_uri = _data_->_tmp20_;
	_data_->_tmp21_ = _data_->local_instance;
	_data_->_tmp22_ = _data_->_tmp21_->priv->app_uri;
	_data_->_tmp23_ = g_strdup_printf ("/com/canonical/unity/launcherentry/%u", g_str_hash (_data_->_tmp22_));
	_data_->_tmp24_ = _data_->_tmp23_;
	_data_->_tmp25_ = g_strdup (_data_->_tmp24_);
	_data_->_tmp26_ = _data_->_tmp25_;
	_g_free0 (_data_->_tmp24_);
	_data_->object_path = _data_->_tmp26_;
	{
		_data_->_state_ = 2;
		g_bus_get (G_BUS_TYPE_SESSION, NULL, granite_services_application_unity_launcher_entry_get_instance_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp27_ = g_bus_get_finish (_data_->_res_, &_data_->_inner_error0_);
		_data_->session_connection = _data_->_tmp27_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp28_ = _data_->session_connection;
		_data_->_tmp29_ = _data_->object_path;
		_data_->_tmp30_ = _data_->local_instance;
		granite_services_application_unity_launcher_entry_register_object (_data_->_tmp30_, _data_->_tmp28_, (const gchar*) _data_->_tmp29_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->session_connection);
			goto __catch0_g_error;
		}
		_data_->_tmp31_ = _data_->local_instance;
		_data_->_tmp32_ = _g_object_ref0 (_data_->_tmp31_);
		_g_object_unref0 (granite_services_application_unity_launcher_entry_instance);
		granite_services_application_unity_launcher_entry_instance = _data_->_tmp32_;
		_g_object_unref0 (_data_->session_connection);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp33_ = granite_services_application_unity_launcher_entry_instance_mutex;
		granite_services_async_mutex_unlock (_data_->_tmp33_);
		_data_->_tmp34_ = _data_->e;
		_data_->_tmp35_ = _g_error_copy0 (_data_->_tmp34_);
		_data_->_inner_error0_ = _data_->_tmp35_;
		_g_error_free0 (_data_->e);
		goto __finally0;
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->object_path);
		_g_object_unref0 (_data_->local_instance);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp36_ = granite_services_application_unity_launcher_entry_instance_mutex;
	granite_services_async_mutex_unlock (_data_->_tmp36_);
	_data_->_tmp37_ = granite_services_application_unity_launcher_entry_instance;
	_data_->result = _data_->_tmp37_;
	_g_free0 (_data_->object_path);
	_g_object_unref0 (_data_->local_instance);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
_g_free0_ (gpointer var)
{
	var = (g_free (var), NULL);
}

static void
_g_variant_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_variant_unref (var), NULL));
}

static gpointer
_g_variant_ref0 (gpointer self)
{
	return self ? g_variant_ref (self) : NULL;
}

 G_GNUC_INTERNAL void
granite_services_application_unity_launcher_entry_set_app_property (GraniteServicesApplicationUnityLauncherEntry* self,
                                                                    const gchar* property,
                                                                    GVariant* var)
{
	GHashTable* updated_properties = NULL;
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	gchar* _tmp3_;
	GVariant* _tmp4_;
	GHashTable* _tmp5_;
	gchar* _tmp6_;
	GVariant* _tmp7_;
	const gchar* _tmp8_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (property != NULL);
	g_return_if_fail (var != NULL);
	_tmp0_ = g_str_hash;
	_tmp1_ = g_str_equal;
	_tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, _g_free0_, _g_variant_unref0_);
	updated_properties = _tmp2_;
	_tmp3_ = g_strdup (property);
	_tmp4_ = _g_variant_ref0 (var);
	g_hash_table_insert (updated_properties, _tmp3_, _tmp4_);
	_tmp5_ = self->priv->properties;
	_tmp6_ = g_strdup (property);
	_tmp7_ = _g_variant_ref0 (var);
	g_hash_table_insert (_tmp5_, _tmp6_, _tmp7_);
	_tmp8_ = self->priv->app_uri;
	g_signal_emit (self, granite_services_application_unity_launcher_entry_signals[GRANITE_SERVICES_APPLICATION_UNITY_LAUNCHER_ENTRY_UPDATE_SIGNAL], 0, _tmp8_, updated_properties);
	_g_hash_table_unref0 (updated_properties);
}

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

static gpointer
_g_hash_table_ref0 (gpointer self)
{
	return self ? g_hash_table_ref (self) : NULL;
}

 G_GNUC_INTERNAL GHashTable*
granite_services_application_unity_launcher_entry_query (GraniteServicesApplicationUnityLauncherEntry* self,
                                                         GError** error)
{
	GHashTable* _tmp0_;
	GHashTable* _tmp1_;
	GHashTable* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->properties;
	_tmp1_ = _g_hash_table_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

 G_GNUC_INTERNAL GraniteServicesApplicationUnityLauncherEntry*
granite_services_application_unity_launcher_entry_construct (GType object_type)
{
	GraniteServicesApplicationUnityLauncherEntry * self = NULL;
	self = (GraniteServicesApplicationUnityLauncherEntry*) g_object_new (object_type, NULL);
	return self;
}

 G_GNUC_INTERNAL GraniteServicesApplicationUnityLauncherEntry*
granite_services_application_unity_launcher_entry_new (void)
{
	return granite_services_application_unity_launcher_entry_construct (GRANITE_SERVICES_APPLICATION_TYPE_UNITY_LAUNCHER_ENTRY);
}

static GObject *
granite_services_application_unity_launcher_entry_constructor (GType type,
                                                               guint n_construct_properties,
                                                               GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GraniteServicesApplicationUnityLauncherEntry * self;
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	GHashTable* _tmp3_;
	gchar* _tmp4_;
	GVariant* _tmp5_;
	GHashTable* _tmp6_;
	gchar* _tmp7_;
	GVariant* _tmp8_;
	GHashTable* _tmp9_;
	gchar* _tmp10_;
	GVariant* _tmp11_;
	GHashTable* _tmp12_;
	gchar* _tmp13_;
	GVariant* _tmp14_;
	GHashTable* _tmp15_;
	gchar* _tmp16_;
	GVariant* _tmp17_;
	parent_class = G_OBJECT_CLASS (granite_services_application_unity_launcher_entry_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRANITE_SERVICES_APPLICATION_TYPE_UNITY_LAUNCHER_ENTRY, GraniteServicesApplicationUnityLauncherEntry);
	_tmp0_ = g_str_hash;
	_tmp1_ = g_str_equal;
	_tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, _g_free0_, _g_variant_unref0_);
	_g_hash_table_unref0 (self->priv->properties);
	self->priv->properties = _tmp2_;
	_tmp3_ = self->priv->properties;
	_tmp4_ = g_strdup ("urgent");
	_tmp5_ = g_variant_new_boolean (FALSE);
	g_variant_ref_sink (_tmp5_);
	g_hash_table_insert (_tmp3_, _tmp4_, _tmp5_);
	_tmp6_ = self->priv->properties;
	_tmp7_ = g_strdup ("count");
	_tmp8_ = g_variant_new_int64 ((gint64) 0);
	g_variant_ref_sink (_tmp8_);
	g_hash_table_insert (_tmp6_, _tmp7_, _tmp8_);
	_tmp9_ = self->priv->properties;
	_tmp10_ = g_strdup ("count-visible");
	_tmp11_ = g_variant_new_boolean (FALSE);
	g_variant_ref_sink (_tmp11_);
	g_hash_table_insert (_tmp9_, _tmp10_, _tmp11_);
	_tmp12_ = self->priv->properties;
	_tmp13_ = g_strdup ("progress");
	_tmp14_ = g_variant_new_double (0.0);
	g_variant_ref_sink (_tmp14_);
	g_hash_table_insert (_tmp12_, _tmp13_, _tmp14_);
	_tmp15_ = self->priv->properties;
	_tmp16_ = g_strdup ("progress-visible");
	_tmp17_ = g_variant_new_boolean (FALSE);
	g_variant_ref_sink (_tmp17_);
	g_hash_table_insert (_tmp15_, _tmp16_, _tmp17_);
	return obj;
}

static void
granite_services_application_unity_launcher_entry_class_init (GraniteServicesApplicationUnityLauncherEntryClass * klass,
                                                              gpointer klass_data)
{
	granite_services_application_unity_launcher_entry_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GraniteServicesApplicationUnityLauncherEntry_private_offset);
	G_OBJECT_CLASS (klass)->constructor = granite_services_application_unity_launcher_entry_constructor;
	G_OBJECT_CLASS (klass)->finalize = granite_services_application_unity_launcher_entry_finalize;
	granite_services_application_unity_launcher_entry_signals[GRANITE_SERVICES_APPLICATION_UNITY_LAUNCHER_ENTRY_UPDATE_SIGNAL] = g_signal_new ("update", GRANITE_SERVICES_APPLICATION_TYPE_UNITY_LAUNCHER_ENTRY, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_BOXED, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_HASH_TABLE);
}

static void
granite_services_application_unity_launcher_entry_instance_init (GraniteServicesApplicationUnityLauncherEntry * self,
                                                                 gpointer klass)
{
	self->priv = granite_services_application_unity_launcher_entry_get_instance_private (self);
}

static void
granite_services_application_unity_launcher_entry_finalize (GObject * obj)
{
	GraniteServicesApplicationUnityLauncherEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRANITE_SERVICES_APPLICATION_TYPE_UNITY_LAUNCHER_ENTRY, GraniteServicesApplicationUnityLauncherEntry);
	_g_free0 (self->priv->app_uri);
	_g_hash_table_unref0 (self->priv->properties);
	G_OBJECT_CLASS (granite_services_application_unity_launcher_entry_parent_class)->finalize (obj);
}

static GType
granite_services_application_unity_launcher_entry_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GraniteServicesApplicationUnityLauncherEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) granite_services_application_unity_launcher_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GraniteServicesApplicationUnityLauncherEntry), 0, (GInstanceInitFunc) granite_services_application_unity_launcher_entry_instance_init, NULL };
	GType granite_services_application_unity_launcher_entry_type_id;
	granite_services_application_unity_launcher_entry_type_id = g_type_register_static (G_TYPE_OBJECT, "GraniteServicesApplicationUnityLauncherEntry", &g_define_type_info, 0);
	g_type_set_qdata (granite_services_application_unity_launcher_entry_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) granite_services_application_unity_launcher_entry_register_object);
	GraniteServicesApplicationUnityLauncherEntry_private_offset = g_type_add_instance_private (granite_services_application_unity_launcher_entry_type_id, sizeof (GraniteServicesApplicationUnityLauncherEntryPrivate));
	return granite_services_application_unity_launcher_entry_type_id;
}

 G_GNUC_INTERNAL GType
granite_services_application_unity_launcher_entry_get_type (void)
{
	static volatile gsize granite_services_application_unity_launcher_entry_type_id__once = 0;
	if (g_once_init_enter (&granite_services_application_unity_launcher_entry_type_id__once)) {
		GType granite_services_application_unity_launcher_entry_type_id;
		granite_services_application_unity_launcher_entry_type_id = granite_services_application_unity_launcher_entry_get_type_once ();
		g_once_init_leave (&granite_services_application_unity_launcher_entry_type_id__once, granite_services_application_unity_launcher_entry_type_id);
	}
	return granite_services_application_unity_launcher_entry_type_id__once;
}

static void
_dbus_granite_services_application_unity_launcher_entry_query (GraniteServicesApplicationUnityLauncherEntry* self,
                                                               GVariant* _parameters_,
                                                               GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	GHashTable* result;
	GVariantBuilder _tmp0_;
	GHashTableIter _tmp1_;
	gpointer _tmp2_;
	gpointer _tmp3_;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	result = granite_services_application_unity_launcher_entry_query (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_hash_table_iter_init (&_tmp1_, result);
	g_variant_builder_init (&_tmp0_, G_VARIANT_TYPE ("a{sv}"));
	while (g_hash_table_iter_next (&_tmp1_, &_tmp2_, &_tmp3_)) {
		gchar* _key;
		GVariant* _value;
		_key = (gchar*) _tmp2_;
		_value = (GVariant*) _tmp3_;
		g_variant_builder_add (&_tmp0_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value));
	}
	g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp0_));
	_g_hash_table_unref0 (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
granite_services_application_unity_launcher_entry_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, "Query") == 0) {
		_dbus_granite_services_application_unity_launcher_entry_query (object, parameters, invocation);
	} else {
		g_object_unref (invocation);
	}
}

static GVariant*
granite_services_application_unity_launcher_entry_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
granite_services_application_unity_launcher_entry_dbus_interface_set_property (GDBusConnection* connection,
                                                                               const gchar* sender,
                                                                               const gchar* object_path,
                                                                               const gchar* interface_name,
                                                                               const gchar* property_name,
                                                                               GVariant* value,
                                                                               GError** error,
                                                                               gpointer user_data)
{
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	return FALSE;
}

static void
_dbus_granite_services_application_unity_launcher_entry_update (GObject* _sender,
                                                                const gchar* app_uri,
                                                                GHashTable* properties,
                                                                gpointer* _data)
{
	GDBusConnection * _connection;
	const gchar * _path;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	GVariantBuilder _tmp4_;
	GHashTableIter _tmp5_;
	gpointer _tmp6_;
	gpointer _tmp7_;
	_connection = _data[1];
	_path = _data[2];
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (app_uri));
	g_hash_table_iter_init (&_tmp5_, properties);
	g_variant_builder_init (&_tmp4_, G_VARIANT_TYPE ("a{sv}"));
	while (g_hash_table_iter_next (&_tmp5_, &_tmp6_, &_tmp7_)) {
		gchar* _key;
		GVariant* _value;
		_key = (gchar*) _tmp6_;
		_value = (GVariant*) _tmp7_;
		g_variant_builder_add (&_tmp4_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value));
	}
	g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp4_));
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_connection_emit_signal (_connection, NULL, _path, "com.canonical.Unity.LauncherEntry", "Update", _arguments, NULL);
}

 G_GNUC_INTERNAL guint
granite_services_application_unity_launcher_entry_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 *) (&_granite_services_application_unity_launcher_entry_dbus_interface_info), &_granite_services_application_unity_launcher_entry_dbus_interface_vtable, data, _granite_services_application_unity_launcher_entry_unregister_object, error);
	if (!result) {
		return 0;
	}
	g_signal_connect (object, "update", (GCallback) _dbus_granite_services_application_unity_launcher_entry_update, data);
	return result;
}

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

static void
granite_services_application_set_badge_data_free (gpointer _data)
{
	GraniteServicesApplicationSetBadgeData* _data_;
	_data_ = _data;
	g_slice_free (GraniteServicesApplicationSetBadgeData, _data_);
}

void
granite_services_application_set_badge (gint64 count,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_)
{
	GraniteServicesApplicationSetBadgeData* _data_;
	_data_ = g_slice_new0 (GraniteServicesApplicationSetBadgeData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, granite_services_application_set_badge_data_free);
	_data_->count = count;
	granite_services_application_set_badge_co (_data_);
}

gboolean
granite_services_application_set_badge_finish (GAsyncResult* _res_,
                                               GError** error)
{
	gboolean result;
	GraniteServicesApplicationSetBadgeData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		gboolean _tmp0_ = FALSE;
		return _tmp0_;
	}
	result = _data_->result;
	return result;
}

/**
         * Set the badge count, usually visible with the dock in the desktop. There is no guarantee
         * that the target environment supports it in any way.
         * For it to be visible, one has to make sure to call set_badge_visible().
         */
static void
granite_services_application_set_badge_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_)
{
	GraniteServicesApplicationSetBadgeData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	granite_services_application_set_badge_co (_data_);
}

static gboolean
granite_services_application_set_badge_co (GraniteServicesApplicationSetBadgeData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	granite_services_application_unity_launcher_entry_get_instance (granite_services_application_set_badge_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp0_ = granite_services_application_unity_launcher_entry_get_instance_finish (_data_->_res_, &_data_->_inner_error0_);
	_data_->instance = _data_->_tmp0_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp1_ = g_variant_new_int64 (_data_->count);
	g_variant_ref_sink (_data_->_tmp1_);
	_data_->_tmp2_ = _data_->_tmp1_;
	granite_services_application_unity_launcher_entry_set_app_property (_data_->instance, "count", _data_->_tmp2_);
	_g_variant_unref0 (_data_->_tmp2_);
	_data_->result = TRUE;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
granite_services_application_set_badge_visible_data_free (gpointer _data)
{
	GraniteServicesApplicationSetBadgeVisibleData* _data_;
	_data_ = _data;
	g_slice_free (GraniteServicesApplicationSetBadgeVisibleData, _data_);
}

void
granite_services_application_set_badge_visible (gboolean visible,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_)
{
	GraniteServicesApplicationSetBadgeVisibleData* _data_;
	_data_ = g_slice_new0 (GraniteServicesApplicationSetBadgeVisibleData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, granite_services_application_set_badge_visible_data_free);
	_data_->visible = visible;
	granite_services_application_set_badge_visible_co (_data_);
}

gboolean
granite_services_application_set_badge_visible_finish (GAsyncResult* _res_,
                                                       GError** error)
{
	gboolean result;
	GraniteServicesApplicationSetBadgeVisibleData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		gboolean _tmp0_ = FALSE;
		return _tmp0_;
	}
	result = _data_->result;
	return result;
}

/**
         * Set the badge visibility.
         */
static void
granite_services_application_set_badge_visible_ready (GObject* source_object,
                                                      GAsyncResult* _res_,
                                                      gpointer _user_data_)
{
	GraniteServicesApplicationSetBadgeVisibleData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	granite_services_application_set_badge_visible_co (_data_);
}

static gboolean
granite_services_application_set_badge_visible_co (GraniteServicesApplicationSetBadgeVisibleData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	granite_services_application_unity_launcher_entry_get_instance (granite_services_application_set_badge_visible_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp0_ = granite_services_application_unity_launcher_entry_get_instance_finish (_data_->_res_, &_data_->_inner_error0_);
	_data_->instance = _data_->_tmp0_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp1_ = g_variant_new_boolean (_data_->visible);
	g_variant_ref_sink (_data_->_tmp1_);
	_data_->_tmp2_ = _data_->_tmp1_;
	granite_services_application_unity_launcher_entry_set_app_property (_data_->instance, "count-visible", _data_->_tmp2_);
	_g_variant_unref0 (_data_->_tmp2_);
	_data_->result = TRUE;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
granite_services_application_set_progress_data_free (gpointer _data)
{
	GraniteServicesApplicationSetProgressData* _data_;
	_data_ = _data;
	g_slice_free (GraniteServicesApplicationSetProgressData, _data_);
}

void
granite_services_application_set_progress (gdouble progress,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_)
{
	GraniteServicesApplicationSetProgressData* _data_;
	_data_ = g_slice_new0 (GraniteServicesApplicationSetProgressData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, granite_services_application_set_progress_data_free);
	_data_->progress = progress;
	granite_services_application_set_progress_co (_data_);
}

gboolean
granite_services_application_set_progress_finish (GAsyncResult* _res_,
                                                  GError** error)
{
	gboolean result;
	GraniteServicesApplicationSetProgressData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		gboolean _tmp0_ = FALSE;
		return _tmp0_;
	}
	result = _data_->result;
	return result;
}

/**
         * Set the progress of the application, usually visible with the dock in the desktop.
         * There is no guarantee that the target environment supports it in any way.
         * For it to be visible, one has to make sure to call set_progress_visible().
         */
static void
granite_services_application_set_progress_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_)
{
	GraniteServicesApplicationSetProgressData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	granite_services_application_set_progress_co (_data_);
}

static gboolean
granite_services_application_set_progress_co (GraniteServicesApplicationSetProgressData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	granite_services_application_unity_launcher_entry_get_instance (granite_services_application_set_progress_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp0_ = granite_services_application_unity_launcher_entry_get_instance_finish (_data_->_res_, &_data_->_inner_error0_);
	_data_->instance = _data_->_tmp0_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp1_ = g_variant_new_double (_data_->progress);
	g_variant_ref_sink (_data_->_tmp1_);
	_data_->_tmp2_ = _data_->_tmp1_;
	granite_services_application_unity_launcher_entry_set_app_property (_data_->instance, "progress", _data_->_tmp2_);
	_g_variant_unref0 (_data_->_tmp2_);
	_data_->result = TRUE;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
granite_services_application_set_progress_visible_data_free (gpointer _data)
{
	GraniteServicesApplicationSetProgressVisibleData* _data_;
	_data_ = _data;
	g_slice_free (GraniteServicesApplicationSetProgressVisibleData, _data_);
}

void
granite_services_application_set_progress_visible (gboolean visible,
                                                   GAsyncReadyCallback _callback_,
                                                   gpointer _user_data_)
{
	GraniteServicesApplicationSetProgressVisibleData* _data_;
	_data_ = g_slice_new0 (GraniteServicesApplicationSetProgressVisibleData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, granite_services_application_set_progress_visible_data_free);
	_data_->visible = visible;
	granite_services_application_set_progress_visible_co (_data_);
}

gboolean
granite_services_application_set_progress_visible_finish (GAsyncResult* _res_,
                                                          GError** error)
{
	gboolean result;
	GraniteServicesApplicationSetProgressVisibleData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		gboolean _tmp0_ = FALSE;
		return _tmp0_;
	}
	result = _data_->result;
	return result;
}

/**
         * Set the progress visibility.
         */
static void
granite_services_application_set_progress_visible_ready (GObject* source_object,
                                                         GAsyncResult* _res_,
                                                         gpointer _user_data_)
{
	GraniteServicesApplicationSetProgressVisibleData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	granite_services_application_set_progress_visible_co (_data_);
}

static gboolean
granite_services_application_set_progress_visible_co (GraniteServicesApplicationSetProgressVisibleData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	granite_services_application_unity_launcher_entry_get_instance (granite_services_application_set_progress_visible_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp0_ = granite_services_application_unity_launcher_entry_get_instance_finish (_data_->_res_, &_data_->_inner_error0_);
	_data_->instance = _data_->_tmp0_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp1_ = g_variant_new_boolean (_data_->visible);
	g_variant_ref_sink (_data_->_tmp1_);
	_data_->_tmp2_ = _data_->_tmp1_;
	granite_services_application_unity_launcher_entry_set_app_property (_data_->instance, "progress-visible", _data_->_tmp2_);
	_g_variant_unref0 (_data_->_tmp2_);
	_data_->result = TRUE;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

