summaryrefslogtreecommitdiff
path: root/embed/ephy-download.h
blob: 5bcfff2a2b02a88c698950ccad4b3f9cf3e31b10 (plain)
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
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
 *  Copyright © 2011 Igalia S.L.
 *
 *  This file is part of Epiphany.
 *
 *  Epiphany 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.
 *
 *  Epiphany 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 Epiphany.  If not, see <http://www.gnu.org/licenses/>.
 */

#pragma once

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

G_BEGIN_DECLS

#define EPHY_TYPE_DOWNLOAD (ephy_download_get_type ())

G_DECLARE_FINAL_TYPE (EphyDownload, ephy_download, EPHY, DOWNLOAD, GObject)

typedef enum
{
  EPHY_DOWNLOAD_ACTION_NONE,
  EPHY_DOWNLOAD_ACTION_BROWSE_TO,
  EPHY_DOWNLOAD_ACTION_OPEN
} EphyDownloadActionType;

EphyDownload *ephy_download_new                   (WebKitDownload *download);
EphyDownload *ephy_download_new_for_uri           (const char     *uri);
EphyDownload *ephy_download_new_for_uri_internal  (const char     *uri);

void          ephy_download_cancel                (EphyDownload *download);
gboolean      ephy_download_is_active             (EphyDownload *download);
gboolean      ephy_download_succeeded             (EphyDownload *download);
gboolean      ephy_download_failed                (EphyDownload *download,
                                                   GError      **error);

void          ephy_download_set_destination_uri   (EphyDownload *download,
                                                   const char *destination);

WebKitDownload *ephy_download_get_webkit_download (EphyDownload *download);

const char   *ephy_download_get_destination_uri   (EphyDownload *download);
const char   *ephy_download_get_content_type      (EphyDownload *download);

guint32       ephy_download_get_start_time        (EphyDownload *download);

EphyDownloadActionType ephy_download_get_action   (EphyDownload *download);
void          ephy_download_set_action            (EphyDownload *download,
                                                   EphyDownloadActionType action);
gboolean      ephy_download_do_download_action    (EphyDownload          *download,
                                                   EphyDownloadActionType action,
                                                   guint32                user_time);
void          ephy_download_disable_desktop_notification
                                                  (EphyDownload *download);

G_END_DECLS