]> git.0d.be Git - empathy.git/blob - libempathy/empathy-tp-file.h
Adapt the code to the tp style.
[empathy.git] / libempathy / empathy-tp-file.h
1 /*
2  * Copyright (C) 2007-2009 Collabora Ltd.
3  * Copyright (C) 2007 Marco Barisione <marco@barisione.org>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18  *
19  * Authors: Marco Barisione <marco@barisione.org>
20  *          Jonny Lamb <jonny.lamb@collabora.co.uk>
21  *          Cosimo Cecchi <cosimo.cecchi@collabora.co.uk>
22  */
23
24 #ifndef __EMPATHY_TP_FILE_H__
25 #define __EMPATHY_TP_FILE_H__
26
27 #include <gio/gio.h>
28 #include <glib.h>
29
30 #include <telepathy-glib/channel.h>
31
32 G_BEGIN_DECLS
33
34 #define EMPATHY_TP_FILE_UNKNOWN_SIZE G_MAXUINT64
35
36 #define EMPATHY_TYPE_TP_FILE (empathy_tp_file_get_type ())
37 #define EMPATHY_TP_FILE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \
38     EMPATHY_TYPE_TP_FILE, EmpathyTpFile))
39 #define EMPATHY_TP_FILE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), \
40     EMPATHY_TYPE_TP_FILE, EmpathyTpFileClass))
41 #define EMPATHY_IS_TP_FILE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
42     EMPATHY_TYPE_TP_FILE))
43 #define EMPATHY_IS_TP_FILE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), \
44     EMPATHY_TYPE_TP_FILE))
45 #define EMPATHY_TP_FILE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), \
46     EMPATHY_TYPE_TP_FILE, EmpathyTpFileClass))
47
48 typedef struct _EmpathyTpFile EmpathyTpFile;
49 typedef struct _EmpathyTpFileClass EmpathyTpFileClass;
50
51 struct _EmpathyTpFile {
52   GObject  parent;
53   gpointer priv;
54 };
55
56 struct _EmpathyTpFileClass {
57   GObjectClass parent_class;
58 };
59
60 /* prototypes for operation callbacks */
61
62 typedef void (* EmpathyTpFileProgressCallback)
63     (EmpathyTpFile *tp_file,
64      guint64 current_bytes,
65      gpointer user_data);
66
67 typedef void (* EmpathyTpFileOperationCallback)
68     (EmpathyTpFile *tp_file,
69      const GError *error,
70      gpointer user_data);
71
72 GType empathy_tp_file_get_type (void) G_GNUC_CONST;
73
74 /* public methods */
75
76 EmpathyTpFile * empathy_tp_file_new (TpChannel *channel,
77     gboolean incoming);
78
79 void empathy_tp_file_accept (EmpathyTpFile *tp_file,
80     guint64 offset,
81     GFile *gfile,
82     GCancellable *cancellable,
83     EmpathyTpFileProgressCallback progress_callback,
84     gpointer progress_user_data,
85     EmpathyTpFileOperationCallback op_callback,
86     gpointer op_user_data);
87
88 void empathy_tp_file_offer (EmpathyTpFile *tp_file,
89     GFile *gfile,
90     GCancellable *cancellable,
91     EmpathyTpFileProgressCallback progress_callback,
92     gpointer progress_user_data,
93     EmpathyTpFileOperationCallback op_callback,
94     gpointer op_user_data);
95
96 void empathy_tp_file_cancel (EmpathyTpFile *tp_file);
97 void empathy_tp_file_close (EmpathyTpFile *tp_file);
98
99 gboolean empathy_tp_file_is_incoming (EmpathyTpFile *tp_file);
100
101 G_END_DECLS
102
103 #endif /* __EMPATHY_TP_FILE_H__ */