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

/*
    IDownloadService.vala
    Copyright (C) 2010 Maia Kozheva <sikon@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gee.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

#define STEADYFLOW_CORE_TYPE_IDOWNLOAD_SERVICE (steadyflow_core_idownload_service_get_type ())
#define STEADYFLOW_CORE_IDOWNLOAD_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STEADYFLOW_CORE_TYPE_IDOWNLOAD_SERVICE, SteadyflowCoreIDownloadService))
#define STEADYFLOW_CORE_IS_IDOWNLOAD_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STEADYFLOW_CORE_TYPE_IDOWNLOAD_SERVICE))
#define STEADYFLOW_CORE_IDOWNLOAD_SERVICE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), STEADYFLOW_CORE_TYPE_IDOWNLOAD_SERVICE, SteadyflowCoreIDownloadServiceIface))

typedef struct _SteadyflowCoreIDownloadService SteadyflowCoreIDownloadService;
typedef struct _SteadyflowCoreIDownloadServiceIface SteadyflowCoreIDownloadServiceIface;

#define STEADYFLOW_CORE_TYPE_IDOWNLOAD_FILE (steadyflow_core_idownload_file_get_type ())
#define STEADYFLOW_CORE_IDOWNLOAD_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STEADYFLOW_CORE_TYPE_IDOWNLOAD_FILE, SteadyflowCoreIDownloadFile))
#define STEADYFLOW_CORE_IS_IDOWNLOAD_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STEADYFLOW_CORE_TYPE_IDOWNLOAD_FILE))
#define STEADYFLOW_CORE_IDOWNLOAD_FILE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), STEADYFLOW_CORE_TYPE_IDOWNLOAD_FILE, SteadyflowCoreIDownloadFileIface))

typedef struct _SteadyflowCoreIDownloadFile SteadyflowCoreIDownloadFile;
typedef struct _SteadyflowCoreIDownloadFileIface SteadyflowCoreIDownloadFileIface;
typedef enum  {
	STEADYFLOW_CORE_IDOWNLOAD_FILE_STATUS_CONNECTING = 0,
	STEADYFLOW_CORE_IDOWNLOAD_FILE_STATUS_DOWNLOADING,
	STEADYFLOW_CORE_IDOWNLOAD_FILE_STATUS_PAUSED,
	STEADYFLOW_CORE_IDOWNLOAD_FILE_STATUS_FINISHED,
	STEADYFLOW_CORE_IDOWNLOAD_FILE_STATUS_NETWORK_ERROR
} SteadyflowCoreIDownloadFileStatus;

#define STEADYFLOW_CORE_IDOWNLOAD_FILE_TYPE_STATUS (steadyflow_core_idownload_file_status_get_type ())
typedef enum  {
	STEADYFLOW_CORE_IDOWNLOAD_FILE_FINISH_ACTION_DO_NOTHING = 0,
	STEADYFLOW_CORE_IDOWNLOAD_FILE_FINISH_ACTION_OPEN_FILE,
	STEADYFLOW_CORE_IDOWNLOAD_FILE_FINISH_ACTION_OPEN_FOLDER,
	STEADYFLOW_CORE_IDOWNLOAD_FILE_FINISH_ACTION_RUN_COMMAND
} SteadyflowCoreIDownloadFileFinishAction;

#define STEADYFLOW_CORE_IDOWNLOAD_FILE_TYPE_FINISH_ACTION (steadyflow_core_idownload_file_finish_action_get_type ())
enum  {
	STEADYFLOW_CORE_IDOWNLOAD_SERVICE_FILE_ADDED_SIGNAL,
	STEADYFLOW_CORE_IDOWNLOAD_SERVICE_FILE_REMOVED_SIGNAL,
	STEADYFLOW_CORE_IDOWNLOAD_SERVICE_NUM_SIGNALS
};
static guint steadyflow_core_idownload_service_signals[STEADYFLOW_CORE_IDOWNLOAD_SERVICE_NUM_SIGNALS] = {0};

struct _SteadyflowCoreIDownloadFileIface {
	GTypeInterface parent_iface;
	void (*start) (SteadyflowCoreIDownloadFile* self, gboolean resume);
	void (*pause) (SteadyflowCoreIDownloadFile* self);
	void (*serialize) (SteadyflowCoreIDownloadFile* self, GKeyFile* file);
	SteadyflowCoreIDownloadFileStatus (*get_status) (SteadyflowCoreIDownloadFile* self);
	gint (*get_uid) (SteadyflowCoreIDownloadFile* self);
	const gchar* (*get_url) (SteadyflowCoreIDownloadFile* self);
	const gchar* (*get_local_name) (SteadyflowCoreIDownloadFile* self);
	const gchar* (*get_local_basename) (SteadyflowCoreIDownloadFile* self);
	gint64 (*get_size) (SteadyflowCoreIDownloadFile* self);
	gint64 (*get_downloaded_size) (SteadyflowCoreIDownloadFile* self);
	gint (*get_speed) (SteadyflowCoreIDownloadFile* self);
	const gchar* (*get_icon_name) (SteadyflowCoreIDownloadFile* self);
	SteadyflowCoreIDownloadFileFinishAction (*get_finish_action) (SteadyflowCoreIDownloadFile* self);
	const gchar* (*get_finish_command) (SteadyflowCoreIDownloadFile* self);
	GError* (*get_error) (SteadyflowCoreIDownloadFile* self);
};

struct _SteadyflowCoreIDownloadServiceIface {
	GTypeInterface parent_iface;
	SteadyflowCoreIDownloadFile* (*get_file_by_uid) (SteadyflowCoreIDownloadService* self, gint uid);
	SteadyflowCoreIDownloadFile* (*add_file) (SteadyflowCoreIDownloadService* self, const gchar* url, const gchar* local_name, SteadyflowCoreIDownloadFileFinishAction finish_action, const gchar* finish_command, GError** error);
	void (*remove_file) (SteadyflowCoreIDownloadService* self, SteadyflowCoreIDownloadFile* file);
	GeeList* (*get_files) (SteadyflowCoreIDownloadService* self);
};

VALA_EXTERN GType steadyflow_core_idownload_file_status_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType steadyflow_core_idownload_file_finish_action_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType steadyflow_core_idownload_file_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SteadyflowCoreIDownloadFile, g_object_unref)
VALA_EXTERN GType steadyflow_core_idownload_service_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SteadyflowCoreIDownloadService, g_object_unref)
VALA_EXTERN SteadyflowCoreIDownloadFile* steadyflow_core_idownload_service_get_file_by_uid (SteadyflowCoreIDownloadService* self,
                                                                                gint uid);
VALA_EXTERN SteadyflowCoreIDownloadFile* steadyflow_core_idownload_service_add_file (SteadyflowCoreIDownloadService* self,
                                                                         const gchar* url,
                                                                         const gchar* local_name,
                                                                         SteadyflowCoreIDownloadFileFinishAction finish_action,
                                                                         const gchar* finish_command,
                                                                         GError** error);
VALA_EXTERN void steadyflow_core_idownload_service_remove_file (SteadyflowCoreIDownloadService* self,
                                                    SteadyflowCoreIDownloadFile* file);
VALA_EXTERN GeeList* steadyflow_core_idownload_service_get_files (SteadyflowCoreIDownloadService* self);
static GType steadyflow_core_idownload_service_get_type_once (void);

SteadyflowCoreIDownloadFile*
steadyflow_core_idownload_service_get_file_by_uid (SteadyflowCoreIDownloadService* self,
                                                   gint uid)
{
	SteadyflowCoreIDownloadServiceIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = STEADYFLOW_CORE_IDOWNLOAD_SERVICE_GET_INTERFACE (self);
	if (_iface_->get_file_by_uid) {
		return _iface_->get_file_by_uid (self, uid);
	}
	return NULL;
}

SteadyflowCoreIDownloadFile*
steadyflow_core_idownload_service_add_file (SteadyflowCoreIDownloadService* self,
                                            const gchar* url,
                                            const gchar* local_name,
                                            SteadyflowCoreIDownloadFileFinishAction finish_action,
                                            const gchar* finish_command,
                                            GError** error)
{
	SteadyflowCoreIDownloadServiceIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = STEADYFLOW_CORE_IDOWNLOAD_SERVICE_GET_INTERFACE (self);
	if (_iface_->add_file) {
		return _iface_->add_file (self, url, local_name, finish_action, finish_command, error);
	}
	return NULL;
}

void
steadyflow_core_idownload_service_remove_file (SteadyflowCoreIDownloadService* self,
                                               SteadyflowCoreIDownloadFile* file)
{
	SteadyflowCoreIDownloadServiceIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = STEADYFLOW_CORE_IDOWNLOAD_SERVICE_GET_INTERFACE (self);
	if (_iface_->remove_file) {
		_iface_->remove_file (self, file);
	}
}

GeeList*
steadyflow_core_idownload_service_get_files (SteadyflowCoreIDownloadService* self)
{
	SteadyflowCoreIDownloadServiceIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = STEADYFLOW_CORE_IDOWNLOAD_SERVICE_GET_INTERFACE (self);
	if (_iface_->get_files) {
		return _iface_->get_files (self);
	}
	return NULL;
}

static void
steadyflow_core_idownload_service_default_init (SteadyflowCoreIDownloadServiceIface * iface,
                                                gpointer iface_data)
{
	g_object_interface_install_property (iface, g_param_spec_object ("files", "files", "files", GEE_TYPE_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	steadyflow_core_idownload_service_signals[STEADYFLOW_CORE_IDOWNLOAD_SERVICE_FILE_ADDED_SIGNAL] = g_signal_new ("file-added", STEADYFLOW_CORE_TYPE_IDOWNLOAD_SERVICE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, STEADYFLOW_CORE_TYPE_IDOWNLOAD_FILE);
	steadyflow_core_idownload_service_signals[STEADYFLOW_CORE_IDOWNLOAD_SERVICE_FILE_REMOVED_SIGNAL] = g_signal_new ("file-removed", STEADYFLOW_CORE_TYPE_IDOWNLOAD_SERVICE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, STEADYFLOW_CORE_TYPE_IDOWNLOAD_FILE);
}

static GType
steadyflow_core_idownload_service_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SteadyflowCoreIDownloadServiceIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) steadyflow_core_idownload_service_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType steadyflow_core_idownload_service_type_id;
	steadyflow_core_idownload_service_type_id = g_type_register_static (G_TYPE_INTERFACE, "SteadyflowCoreIDownloadService", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (steadyflow_core_idownload_service_type_id, G_TYPE_OBJECT);
	return steadyflow_core_idownload_service_type_id;
}

GType
steadyflow_core_idownload_service_get_type (void)
{
	static volatile gsize steadyflow_core_idownload_service_type_id__once = 0;
	if (g_once_init_enter (&steadyflow_core_idownload_service_type_id__once)) {
		GType steadyflow_core_idownload_service_type_id;
		steadyflow_core_idownload_service_type_id = steadyflow_core_idownload_service_get_type_once ();
		g_once_init_leave (&steadyflow_core_idownload_service_type_id__once, steadyflow_core_idownload_service_type_id);
	}
	return steadyflow_core_idownload_service_type_id__once;
}

