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

#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <packagekit-glib2/packagekit.h>
#include <glib/gi18n-lib.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

typedef enum  {
	SETTINGS_DAEMON_PK_UTILS_STATE_UP_TO_DATE,
	SETTINGS_DAEMON_PK_UTILS_STATE_CHECKING,
	SETTINGS_DAEMON_PK_UTILS_STATE_AVAILABLE,
	SETTINGS_DAEMON_PK_UTILS_STATE_DOWNLOADING,
	SETTINGS_DAEMON_PK_UTILS_STATE_RESTART_REQUIRED,
	SETTINGS_DAEMON_PK_UTILS_STATE_ERROR
} SettingsDaemonPkUtilsState;

#define SETTINGS_DAEMON_PK_UTILS_TYPE_STATE (settings_daemon_pk_utils_state_get_type ())

#define SETTINGS_DAEMON_PK_UTILS_TYPE_CURRENT_STATE (settings_daemon_pk_utils_current_state_get_type ())
typedef struct _SettingsDaemonPkUtilsCurrentState SettingsDaemonPkUtilsCurrentState;
#define _g_free0(var) (var = (g_free (var), NULL))

struct _SettingsDaemonPkUtilsCurrentState {
	SettingsDaemonPkUtilsState state;
	gchar* status;
	guint percentage;
	guint64 download_size_remaining;
};

VALA_EXTERN GType settings_daemon_pk_utils_state_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType settings_daemon_pk_utils_current_state_get_type (void) G_GNUC_CONST ;
VALA_EXTERN SettingsDaemonPkUtilsCurrentState* settings_daemon_pk_utils_current_state_dup (const SettingsDaemonPkUtilsCurrentState* self);
VALA_EXTERN void settings_daemon_pk_utils_current_state_free (SettingsDaemonPkUtilsCurrentState* self);
VALA_EXTERN void settings_daemon_pk_utils_current_state_copy (const SettingsDaemonPkUtilsCurrentState* self,
                                                  SettingsDaemonPkUtilsCurrentState* dest);
VALA_EXTERN void settings_daemon_pk_utils_current_state_destroy (SettingsDaemonPkUtilsCurrentState* self);
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (SettingsDaemonPkUtilsCurrentState, settings_daemon_pk_utils_current_state_destroy)
VALA_EXTERN const gchar* settings_daemon_pk_utils_status_to_title (PkStatusEnum status);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static GType
settings_daemon_pk_utils_state_get_type_once (void)
{
	static const GEnumValue values[] = {{SETTINGS_DAEMON_PK_UTILS_STATE_UP_TO_DATE, "SETTINGS_DAEMON_PK_UTILS_STATE_UP_TO_DATE", "up-to-date"}, {SETTINGS_DAEMON_PK_UTILS_STATE_CHECKING, "SETTINGS_DAEMON_PK_UTILS_STATE_CHECKING", "checking"}, {SETTINGS_DAEMON_PK_UTILS_STATE_AVAILABLE, "SETTINGS_DAEMON_PK_UTILS_STATE_AVAILABLE", "available"}, {SETTINGS_DAEMON_PK_UTILS_STATE_DOWNLOADING, "SETTINGS_DAEMON_PK_UTILS_STATE_DOWNLOADING", "downloading"}, {SETTINGS_DAEMON_PK_UTILS_STATE_RESTART_REQUIRED, "SETTINGS_DAEMON_PK_UTILS_STATE_RESTART_REQUIRED", "restart-required"}, {SETTINGS_DAEMON_PK_UTILS_STATE_ERROR, "SETTINGS_DAEMON_PK_UTILS_STATE_ERROR", "error"}, {0, NULL, NULL}};
	GType settings_daemon_pk_utils_state_type_id;
	settings_daemon_pk_utils_state_type_id = g_enum_register_static ("SettingsDaemonPkUtilsState", values);
	return settings_daemon_pk_utils_state_type_id;
}

GType
settings_daemon_pk_utils_state_get_type (void)
{
	static volatile gsize settings_daemon_pk_utils_state_type_id__once = 0;
	if (g_once_init_enter (&settings_daemon_pk_utils_state_type_id__once)) {
		GType settings_daemon_pk_utils_state_type_id;
		settings_daemon_pk_utils_state_type_id = settings_daemon_pk_utils_state_get_type_once ();
		g_once_init_leave (&settings_daemon_pk_utils_state_type_id__once, settings_daemon_pk_utils_state_type_id);
	}
	return settings_daemon_pk_utils_state_type_id__once;
}

void
settings_daemon_pk_utils_current_state_copy (const SettingsDaemonPkUtilsCurrentState* self,
                                             SettingsDaemonPkUtilsCurrentState* dest)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	(*dest).state = (*self).state;
	_tmp0_ = (*self).status;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 ((*dest).status);
	(*dest).status = _tmp1_;
	(*dest).percentage = (*self).percentage;
	(*dest).download_size_remaining = (*self).download_size_remaining;
}

void
settings_daemon_pk_utils_current_state_destroy (SettingsDaemonPkUtilsCurrentState* self)
{
	_g_free0 ((*self).status);
}

SettingsDaemonPkUtilsCurrentState*
settings_daemon_pk_utils_current_state_dup (const SettingsDaemonPkUtilsCurrentState* self)
{
	SettingsDaemonPkUtilsCurrentState* dup;
	dup = g_new0 (SettingsDaemonPkUtilsCurrentState, 1);
	settings_daemon_pk_utils_current_state_copy (self, dup);
	return dup;
}

void
settings_daemon_pk_utils_current_state_free (SettingsDaemonPkUtilsCurrentState* self)
{
	settings_daemon_pk_utils_current_state_destroy (self);
	g_free (self);
}

static GType
settings_daemon_pk_utils_current_state_get_type_once (void)
{
	GType settings_daemon_pk_utils_current_state_type_id;
	settings_daemon_pk_utils_current_state_type_id = g_boxed_type_register_static ("SettingsDaemonPkUtilsCurrentState", (GBoxedCopyFunc) settings_daemon_pk_utils_current_state_dup, (GBoxedFreeFunc) settings_daemon_pk_utils_current_state_free);
	return settings_daemon_pk_utils_current_state_type_id;
}

GType
settings_daemon_pk_utils_current_state_get_type (void)
{
	static volatile gsize settings_daemon_pk_utils_current_state_type_id__once = 0;
	if (g_once_init_enter (&settings_daemon_pk_utils_current_state_type_id__once)) {
		GType settings_daemon_pk_utils_current_state_type_id;
		settings_daemon_pk_utils_current_state_type_id = settings_daemon_pk_utils_current_state_get_type_once ();
		g_once_init_leave (&settings_daemon_pk_utils_current_state_type_id__once, settings_daemon_pk_utils_current_state_type_id);
	}
	return settings_daemon_pk_utils_current_state_type_id__once;
}

const gchar*
settings_daemon_pk_utils_status_to_title (PkStatusEnum status)
{
	const gchar* result;
	switch (status) {
		case PK_STATUS_ENUM_SETUP:
		{
			result = _ ("Starting");
			return result;
		}
		case PK_STATUS_ENUM_WAIT:
		{
			result = _ ("Waiting");
			return result;
		}
		case PK_STATUS_ENUM_RUNNING:
		{
			result = _ ("Running");
			return result;
		}
		case PK_STATUS_ENUM_QUERY:
		{
			result = _ ("Querying");
			return result;
		}
		case PK_STATUS_ENUM_INFO:
		{
			result = _ ("Getting information");
			return result;
		}
		case PK_STATUS_ENUM_REMOVE:
		{
			result = _ ("Removing packages");
			return result;
		}
		case PK_STATUS_ENUM_DOWNLOAD:
		{
			result = _ ("Downloading");
			return result;
		}
		case PK_STATUS_ENUM_REFRESH_CACHE:
		{
			result = _ ("Refreshing software list");
			return result;
		}
		case PK_STATUS_ENUM_UPDATE:
		{
			result = _ ("Installing updates");
			return result;
		}
		case PK_STATUS_ENUM_CLEANUP:
		{
			result = _ ("Cleaning up packages");
			return result;
		}
		case PK_STATUS_ENUM_OBSOLETE:
		{
			result = _ ("Obsoleting packages");
			return result;
		}
		case PK_STATUS_ENUM_DEP_RESOLVE:
		{
			result = _ ("Resolving dependencies");
			return result;
		}
		case PK_STATUS_ENUM_SIG_CHECK:
		{
			result = _ ("Checking signatures");
			return result;
		}
		case PK_STATUS_ENUM_TEST_COMMIT:
		{
			result = _ ("Testing changes");
			return result;
		}
		case PK_STATUS_ENUM_COMMIT:
		{
			result = _ ("Committing changes");
			return result;
		}
		case PK_STATUS_ENUM_REQUEST:
		{
			result = _ ("Requesting data");
			return result;
		}
		case PK_STATUS_ENUM_FINISHED:
		{
			result = _ ("Finished");
			return result;
		}
		case PK_STATUS_ENUM_CANCEL:
		{
			result = _ ("Cancelling");
			return result;
		}
		case PK_STATUS_ENUM_DOWNLOAD_REPOSITORY:
		{
			result = _ ("Downloading repository information");
			return result;
		}
		case PK_STATUS_ENUM_DOWNLOAD_PACKAGELIST:
		{
			result = _ ("Downloading list of packages");
			return result;
		}
		case PK_STATUS_ENUM_DOWNLOAD_FILELIST:
		{
			result = _ ("Downloading file lists");
			return result;
		}
		case PK_STATUS_ENUM_DOWNLOAD_CHANGELOG:
		{
			result = _ ("Downloading lists of changes");
			return result;
		}
		case PK_STATUS_ENUM_DOWNLOAD_GROUP:
		{
			result = _ ("Downloading groups");
			return result;
		}
		case PK_STATUS_ENUM_DOWNLOAD_UPDATEINFO:
		{
			result = _ ("Downloading update information");
			return result;
		}
		case PK_STATUS_ENUM_REPACKAGING:
		{
			result = _ ("Repackaging files");
			return result;
		}
		case PK_STATUS_ENUM_LOADING_CACHE:
		{
			result = _ ("Loading cache");
			return result;
		}
		case PK_STATUS_ENUM_SCAN_APPLICATIONS:
		{
			result = _ ("Scanning applications");
			return result;
		}
		case PK_STATUS_ENUM_GENERATE_PACKAGE_LIST:
		{
			result = _ ("Generating package lists");
			return result;
		}
		case PK_STATUS_ENUM_WAITING_FOR_LOCK:
		{
			result = _ ("Waiting for package manager lock");
			return result;
		}
		case PK_STATUS_ENUM_WAITING_FOR_AUTH:
		{
			result = _ ("Waiting for authentication");
			return result;
		}
		case PK_STATUS_ENUM_SCAN_PROCESS_LIST:
		{
			result = _ ("Updating running applications");
			return result;
		}
		case PK_STATUS_ENUM_CHECK_EXECUTABLE_FILES:
		{
			result = _ ("Checking applications in use");
			return result;
		}
		case PK_STATUS_ENUM_CHECK_LIBRARIES:
		{
			result = _ ("Checking libraries in use");
			return result;
		}
		case PK_STATUS_ENUM_COPY_FILES:
		{
			result = _ ("Copying files");
			return result;
		}
		default:
		case PK_STATUS_ENUM_INSTALL:
		{
			result = _ ("Installing");
			return result;
		}
	}
}

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;
}

