aboutsummaryrefslogtreecommitdiffstats
path: root/embed/ephy-download.h
blob: 64d483b2ace38381ef804395ea6ef85dcaeedd11 (plain) (blame)
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
/*
 *  Copyright (C) 2000-2003 Marco Pesenti Gritti
 *
 *  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 2, 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, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 *  $Id$
 */

#ifndef EPHY_DOWNLOAD_H
#define EPHY_DOWNLOAD_H

#include <glib-object.h>
#include <glib.h>

G_BEGIN_DECLS

#define EPHY_TYPE_DOWNLOAD      (ephy_download_get_type ())
#define EPHY_DOWNLOAD(o)        (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_DOWNLOAD, EphyDownload))
#define EPHY_DOWNLOAD_CLASS(k)      (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_DOWNLOAD, EphyDownloadClass))
#define EPHY_IS_DOWNLOAD(o)     (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_DOWNLOAD))
#define EPHY_IS_DOWNLOAD_CLASS(k)   (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_DOWNLOAD))
#define EPHY_DOWNLOAD_GET_CLASS(o)  (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_DOWNLOAD, EphyDownloadClass))

typedef struct EphyDownload EphyDownload;
typedef struct EphyDownloadClass EphyDownloadClass;
typedef struct EphyDownloadPrivate EphyDownloadPrivate;

typedef enum
{
    EPHY_DOWNLOAD_INITIALISING,
    EPHY_DOWNLOAD_DOWNLOADING,
    EPHY_DOWNLOAD_PAUSED,
    EPHY_DOWNLOAD_COMPLETED,
    EPHY_DOWNLOAD_FAILED
} EphyDownloadState;

struct EphyDownload
{
        GObject parent;

    /*< private >*/
    EphyDownloadPrivate *priv;
};

struct EphyDownloadClass
{
        GObjectClass parent_class;

    char *        (* get_source)           (EphyDownload *download);
    char *        (* get_target)           (EphyDownload *download);
    char *        (* get_mime)             (EphyDownload *download);
    int           (* get_percent)          (EphyDownload *download);
    long          (* get_current_progress) (EphyDownload *download);
    long          (* get_total_progress)   (EphyDownload *download);
    long          (* get_elapsed_time)     (EphyDownload *download);
    void          (* cancel)               (EphyDownload *download);
    void          (* pause)                (EphyDownload *download);
    void          (* resume)               (EphyDownload *download);
    EphyDownloadState (* get_state)            (EphyDownload *download);

    /* Signals */
    void              (* changed)              (EphyDownload *download);
};

/* Time is expressed in seconds, file sizes in bytes */

GType              ephy_download_get_type             (void);

EphyDownload      *ephy_download_new                  (void);

char              *ephy_download_get_name         (EphyDownload *download);

char              *ephy_download_get_source       (EphyDownload *download);

char              *ephy_download_get_target           (EphyDownload *download);

char              *ephy_download_get_mime             (EphyDownload *download);

int                ephy_download_get_percent          (EphyDownload *download);

EphyDownloadState  ephy_download_get_state        (EphyDownload *download);    

long               ephy_download_get_current_progress (EphyDownload *download);

long               ephy_download_get_total_progress   (EphyDownload *download);

long           ephy_download_get_elapsed_time     (EphyDownload *download);

long           ephy_download_get_remaining_time   (EphyDownload *download);

void           ephy_download_cancel               (EphyDownload *download);

void           ephy_download_pause            (EphyDownload *download);

void           ephy_download_resume           (EphyDownload *download);

G_END_DECLS

#endif