81 lines
2.9 KiB
C
81 lines
2.9 KiB
C
|
/*
|
||
|
* Copyright (C) 2012 - Juan Ferrer Toribio
|
||
|
*
|
||
|
* 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/>.
|
||
|
*/
|
||
|
|
||
|
#ifndef DB_FILE_LOADER_H
|
||
|
#define DB_FILE_LOADER_H
|
||
|
|
||
|
#include <sql/sql.h>
|
||
|
|
||
|
#define DB_FILE_LOADER_LOG_DOMAIN g_quark_from_string ("DbFileLoader")
|
||
|
|
||
|
#define DB_TYPE_FILE_LOADER (db_file_loader_get_type ())
|
||
|
#define DB_FILE_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, DB_TYPE_FILE_LOADER, DbFileLoader))
|
||
|
#define DB_IS_FILE_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, DB_TYPE_FILE_LOADER))
|
||
|
#define DB_FILE_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST (klass, DB_TYPE_FILE_LOADER, DbFileLoaderClass))
|
||
|
#define DB_IS_FILE_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE (klass, DB_TYPE_FILE_LOADER))
|
||
|
#define DB_FILE_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS (obj, DB_TYPE_FILE_LOADER, DbFileLoaderClass))
|
||
|
|
||
|
typedef struct _DbFileLoader DbFileLoader;
|
||
|
typedef struct _DbFileLoaderClass DbFileLoaderClass;
|
||
|
typedef struct _DbFileLoaderPrivate DbFileLoaderPrivate;
|
||
|
|
||
|
/**
|
||
|
* DbFileLoaderCallbackFunc:
|
||
|
* @obj: a #DbFileLoader
|
||
|
* @data: the data of a file
|
||
|
* @error: a destination for a #GError
|
||
|
* @user_data: (closure): pointer to user data
|
||
|
*
|
||
|
* Function to call after any operation, successful or not. If the operation was
|
||
|
* cancelled, the error #G_IO_ERROR_CANCELLED will be returned.
|
||
|
**/
|
||
|
typedef void (* DbFileLoaderCallbackFunc) (DbFileLoader * obj
|
||
|
,GBytes * data
|
||
|
,const GError * error
|
||
|
,gpointer user_data);
|
||
|
|
||
|
struct _DbFileLoader
|
||
|
{
|
||
|
GObject parent;
|
||
|
DbFileLoaderPrivate * priv;
|
||
|
};
|
||
|
|
||
|
struct _DbFileLoaderClass
|
||
|
{
|
||
|
/* <private> */
|
||
|
GObjectClass parent;
|
||
|
};
|
||
|
|
||
|
GType db_file_loader_get_type ();
|
||
|
DbFileLoader * db_file_loader_new (const gchar * host
|
||
|
,const gchar * path);
|
||
|
DbFileLoader * db_file_loader_new_simple (const gchar * host
|
||
|
,const gchar * path);
|
||
|
void db_file_loader_download (DbFileLoader * obj
|
||
|
,const gchar * path
|
||
|
,DbFileLoaderCallbackFunc func
|
||
|
,gpointer user_data);
|
||
|
void db_file_loader_cancel_all (DbFileLoader * obj);
|
||
|
void db_file_loader_cancel_by_name (DbFileLoader * obj
|
||
|
,const gchar * name);
|
||
|
void db_file_loader_upload (DbFileLoader * obj
|
||
|
,GBytes * data
|
||
|
,const gchar * path
|
||
|
,DbFileLoaderCallbackFunc func
|
||
|
,gpointer user_data);
|
||
|
|
||
|
#endif
|