From 92778cc0fa77a252763dee87ed1f95f9c7e95cb1 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Tue, 17 Feb 2009 12:03:58 +0100 Subject: W.I.P. for heavy lifting on EmpathyTpFile. --- libempathy/empathy-tp-file.h | 66 +++++++++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 26 deletions(-) (limited to 'libempathy/empathy-tp-file.h') diff --git a/libempathy/empathy-tp-file.h b/libempathy/empathy-tp-file.h index 1d4443153..a1447f382 100644 --- a/libempathy/empathy-tp-file.h +++ b/libempathy/empathy-tp-file.h @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * Copyright (C) 2007-2008 Collabora Ltd. + * Copyright (C) 2007-2009 Collabora Ltd. * Copyright (C) 2007 Marco Barisione * * This library is free software; you can redistribute it and/or @@ -19,6 +19,7 @@ * * Authors: Marco Barisione * Jonny Lamb + * Cosimo Cecchi */ #ifndef __EMPATHY_TP_FILE_H__ @@ -29,10 +30,6 @@ #include -#include "empathy-contact.h" - -#include - G_BEGIN_DECLS #define EMPATHY_TP_FILE_UNKNOWN_SIZE G_MAXUINT64 @@ -50,10 +47,9 @@ typedef struct _EmpathyTpFileClass EmpathyTpFileClass; struct _EmpathyTpFile { - GObject parent; + GObject parent; - /**/ - EmpathyTpFilePriv *priv; + gpointer priv; }; struct _EmpathyTpFileClass @@ -61,28 +57,46 @@ struct _EmpathyTpFileClass GObjectClass parent_class; }; +/* prototypes for operation callbacks */ + +typedef void (* EmpathyTpFileProgressCallback) + (EmpathyTpFile *tp_file, + guint64 current_bytes, + guint64 total_bytes, + gpointer user_data); + +typedef void (* EmpathyTpFileOperationCallback) + (EmpathyTpFile *tp_file, + const GError *error, + gpointer user_data); + GType empathy_tp_file_get_type (void) G_GNUC_CONST; -EmpathyTpFile *empathy_tp_file_new (TpChannel *channel); +/* public methods */ + +EmpathyTpFile * empathy_tp_file_new (TpChannel *channel); + +void empathy_tp_file_accept (EmpathyTpFile *tp_file, + guint64 offset, + GFile *gfile, + GCancellable *cancellable, + EmpathyTpFileProgressCallback progress_callback, + gpointer progress_user_data, + EmpathyTpFileOperationCallback op_callback, + gpointer op_user_data); + +void empathy_tp_file_offer (EmpathyTpFile *tp_file, + GFile *gfile, + GCancellable *cancellable, + EmpathyTpFileProgressCallback progress_callback, + gpointer progress_user_data, + EmpathyTpFileOperationCallback op_callback, + gpointer op_user_data); -TpChannel *empathy_tp_file_get_channel (EmpathyTpFile *tp_file); -void empathy_tp_file_accept (EmpathyTpFile *tp_file, guint64 offset, - GFile *gfile, GError **error); void empathy_tp_file_cancel (EmpathyTpFile *tp_file); -void empathy_tp_file_offer (EmpathyTpFile *tp_file, GFile *gfile, - GError **error); - -EmpathyContact *empathy_tp_file_get_contact (EmpathyTpFile *tp_file); -const gchar *empathy_tp_file_get_filename (EmpathyTpFile *tp_file); -gboolean empathy_tp_file_is_incoming (EmpathyTpFile *tp_file); -TpFileTransferState empathy_tp_file_get_state ( - EmpathyTpFile *tp_file, TpFileTransferStateChangeReason *reason); -guint64 empathy_tp_file_get_size (EmpathyTpFile *tp_file); -guint64 empathy_tp_file_get_transferred_bytes (EmpathyTpFile *tp_file); -gint empathy_tp_file_get_remaining_time (EmpathyTpFile *tp_file); -gdouble empathy_tp_file_get_speed (EmpathyTpFile *tp_file); -const gchar *empathy_tp_file_get_content_type (EmpathyTpFile *tp_file); -gboolean empathy_tp_file_is_ready (EmpathyTpFile *tp_file); +void empathy_tp_file_close (EmpathyTpFile *tp_file); + +guint empathy_tp_file_get_state (EmpathyTpFile *tp_file, guint *reason); G_END_DECLS -- cgit v1.2.3