/
mms_transfer_list.c
132 lines (119 loc) · 3.57 KB
/
mms_transfer_list.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/*
* Copyright (C) 2016-2019 Jolla Ltd.
* Copyright (C) 2016-2019 Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2019 Open Mobile Platform LLC.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* 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.
*/
#include "mms_transfer_list.h"
/* Logging */
#define GLOG_MODULE_NAME mms_transfer_list_log
#include "mms_lib_log.h"
#include <gutil_log.h>
GLOG_MODULE_DEFINE("mms-transfer-list");
G_DEFINE_ABSTRACT_TYPE(MMSTransferList, mms_transfer_list, G_TYPE_OBJECT)
#define MMS_TRANSFER_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
MMS_TYPE_TRANSFER_LIST, MMSTransferList))
#define MMS_TRANSFER_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), \
MMS_TYPE_TRANSFER_LIST, MMSTransferListClass))
static
void
mms_transfer_list_class_init(
MMSTransferListClass* klass)
{
}
static
void
mms_transfer_list_init(
MMSTransferList* self)
{
}
MMSTransferList*
mms_transfer_list_ref(
MMSTransferList* self)
{
if (self) {
GASSERT(MMS_TRANSFER_LIST(self));
g_object_ref(self);
}
return self;
}
void
mms_transfer_list_unref(
MMSTransferList* self)
{
if (self) {
GASSERT(MMS_TRANSFER_LIST(self));
g_object_unref(self);
}
}
void
mms_transfer_list_transfer_started(
MMSTransferList* self, /* Instance */
char* id, /* Database record ID */
char* type) /* Transfer type */
{
if (self && id && type) {
MMSTransferListClass* klass = MMS_TRANSFER_LIST_GET_CLASS(self);
if (klass->fn_transfer_started) {
klass->fn_transfer_started(self, id, type);
}
}
}
void
mms_transfer_list_transfer_finished(
MMSTransferList* self, /* Instance */
char* id, /* Database record ID */
char* type) /* Transfer type */
{
if (self && id) {
MMSTransferListClass* klass = MMS_TRANSFER_LIST_GET_CLASS(self);
if (klass->fn_transfer_finished) {
klass->fn_transfer_finished(self, id, type);
}
}
}
void
mms_transfer_list_transfer_send_progress(
MMSTransferList* self, /* Instance */
char* id, /* Message ID */
char* type, /* Transfer type */
guint sent, /* Bytes sent so far */
guint total) /* Total bytes to send */
{
if (self && id) {
MMSTransferListClass* klass = MMS_TRANSFER_LIST_GET_CLASS(self);
if (klass->fn_send_progress) {
klass->fn_send_progress(self, id, type, sent, total);
}
}
}
void
mms_transfer_list_transfer_receive_progress(
MMSTransferList* self, /* Instance */
char* id, /* Message ID */
char* type, /* Transfer type */
guint received, /* Bytes received so far */
guint total) /* Total bytes to receive*/
{
if (self && id) {
MMSTransferListClass* klass = MMS_TRANSFER_LIST_GET_CLASS(self);
if (klass->fn_receive_progress) {
klass->fn_receive_progress(self, id, type, received, total);
}
}
}
/*
* Local Variables:
* mode: C
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*/