NetSurf
Data Structures | Macros | Enumerations | Functions | Variables
download.c File Reference
#include <string.h>
#include <proto/wb.h>
#include <proto/asl.h>
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/intuition.h>
#include <proto/utility.h>
#include <proto/icon.h>
#include <workbench/icon.h>
#include <proto/window.h>
#include <proto/layout.h>
#include <proto/fuelgauge.h>
#include <classes/window.h>
#include <gadgets/fuelgauge.h>
#include <gadgets/layout.h>
#include <reaction/reaction_macros.h>
#include "utils/errors.h"
#include "utils/nsurl.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/utils.h"
#include "utils/nsoption.h"
#include "netsurf/browser_window.h"
#include "netsurf/mouse.h"
#include "netsurf/window.h"
#include "netsurf/download.h"
#include "content/handlers/image/ico.h"
#include "desktop/download.h"
#include "desktop/save_complete.h"
#include "amiga/gui.h"
#include "amiga/download.h"
#include "amiga/object.h"
#include "amiga/bitmap.h"
#include "amiga/icon.h"
#include "amiga/file.h"
#include "amiga/iff_dr2d.h"
#include "amiga/libs.h"
#include "amiga/misc.h"
#include "amiga/theme.h"
#include "amiga/utf8.h"
Include dependency graph for download.c:

Go to the source code of this file.

Data Structures

struct  gui_download_window
 context for each download. More...
 

Macros

#define APPNOTIFY_DisplayTime   ( TAG_USER + 13 )
 
#define APPNOTIFY_Percentage   ( TAG_USER + 14 )
 
#define APPNOTIFY_StopBackMsg   ( TAG_USER + 17 )
 

Enumerations

enum  {
  OID_D_MAIN = 0 , GID_D_MAIN , GID_D_STATUS , GID_D_CANCEL ,
  GID_D_LAST
}
 
enum  { AMINS_DLOAD_PROGRESS = 0 , AMINS_DLOAD_OK , AMINS_DLOAD_ERROR , AMINS_DLOAD_ABORT }
 

Functions

static void ami_download_window_abort (void *w)
 
static BOOL ami_download_window_event (void *w)
 
static struct gui_download_windowgui_download_window_create (download_context *ctx, struct gui_window *gui)
 
static nserror gui_download_window_data (struct gui_download_window *dw, const char *data, unsigned int size)
 
static void gui_download_window_done (struct gui_download_window *dw)
 
static void gui_download_window_error (struct gui_download_window *dw, const char *error_msg)
 
void ami_free_download_list (struct List *dllist)
 
nserror gui_window_save_link (struct gui_window *g, nsurl *url, const char *title)
 
BOOL ami_download_check_overwrite (const char *file, struct Window *win, ULONG size)
 
void ami_download_parse_backmsg (const char *backmsg)
 

Variables

static const struct ami_win_event_table ami_download_table
 
static int downloads_in_progress = 0
 
static struct gui_download_table download_table
 
struct gui_download_tableamiga_download_table = &download_table
 

Macro Definition Documentation

◆ APPNOTIFY_DisplayTime

#define APPNOTIFY_DisplayTime   ( TAG_USER + 13 )

Definition at line 72 of file download.c.

◆ APPNOTIFY_Percentage

#define APPNOTIFY_Percentage   ( TAG_USER + 14 )

Definition at line 76 of file download.c.

◆ APPNOTIFY_StopBackMsg

#define APPNOTIFY_StopBackMsg   ( TAG_USER + 17 )

Definition at line 80 of file download.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
OID_D_MAIN 
GID_D_MAIN 
GID_D_STATUS 
GID_D_CANCEL 
GID_D_LAST 

Definition at line 83 of file download.c.

◆ anonymous enum

anonymous enum
Enumerator
AMINS_DLOAD_PROGRESS 
AMINS_DLOAD_OK 
AMINS_DLOAD_ERROR 
AMINS_DLOAD_ABORT 

Definition at line 107 of file download.c.

Function Documentation

◆ ami_download_check_overwrite()

BOOL ami_download_check_overwrite ( const char *  file,
struct Window *  win,
ULONG  size 
)

Definition at line 481 of file download.c.

References amiga_warn_user_multi(), ASPrintf(), GetFileSize(), human_friendly_bytesize(), messages_get(), and nsoption_bool.

Referenced by ami_file_save(), gui_download_window_create(), and gui_window_save_link().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ami_download_parse_backmsg()

void ami_download_parse_backmsg ( const char *  backmsg)

Definition at line 520 of file download.c.

Referenced by ami_handle_applib().

Here is the caller graph for this function:

◆ ami_download_window_abort()

static void ami_download_window_abort ( void *  w)
static

Definition at line 372 of file download.c.

References AMINS_DLOAD_ABORT, gui_download_window::ctx, download_context_abort(), gui_download_window_done(), gui_download_window::result, and gui_download_window::w.

Referenced by ami_download_window_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ami_download_window_event()

static BOOL ami_download_window_event ( void *  w)
static

Definition at line 380 of file download.c.

References ami_download_window_abort(), GID_D_CANCEL, gui_download_window::objects, OID_D_MAIN, result, and gui_download_window::w.

Here is the call graph for this function:

◆ ami_free_download_list()

void ami_free_download_list ( struct List *  dllist)

Definition at line 407 of file download.c.

References GetHead(), GetSucc(), and dlnode::node.

Referenced by gui_window_destroy().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gui_download_window_create()

static struct gui_download_window * gui_download_window_create ( download_context ctx,
struct gui_window gui 
)
static

◆ gui_download_window_data()

static nserror gui_download_window_data ( struct gui_download_window dw,
const char *  data,
unsigned int  size 
)
static

Definition at line 245 of file download.c.

References ami_gui_get_app_id(), APPNOTIFY_Percentage, gui_download_window::downloaded, gui_download_window::fh, GID_D_STATUS, messages_get(), Notify, NSERROR_OK, NSERROR_SAVE_FAILED, nsoption_bool, gui_download_window::objects, gui_download_window::progress, RefreshSetGadgetAttrs(), gui_download_window::size, and gui_download_window::win.

Here is the call graph for this function:

◆ gui_download_window_done()

static void gui_download_window_done ( struct gui_download_window dw)
static

Definition at line 293 of file download.c.

References ami_gui_get_app_id(), ami_gui_win_list_remove(), ami_try_quit(), amiga_warn_user(), AMINS_DLOAD_OK, AMINS_DLOAD_PROGRESS, browser_window_navigate(), browser_window::bw, gui_download_window::bw, BW_NAVIGATE_DOWNLOAD, gui_download_window::ctx, gui_download_window::dln, download_context_destroy(), downloads_in_progress, FClose, gui_download_window::fh, dlnode::filename, gui_download_window::fname, GetSucc(), messages_get(), dlnode::node, Notify, NSERROR_OK, nsoption_bool, nsurl_create(), nsurl_unref(), gui_download_window::objects, OID_D_MAIN, gui_download_window::result, and gui_download_window::url.

Referenced by ami_download_window_abort(), and gui_download_window_error().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gui_download_window_error()

static void gui_download_window_error ( struct gui_download_window dw,
const char *  error_msg 
)
static

Definition at line 364 of file download.c.

References amiga_warn_user(), AMINS_DLOAD_ERROR, gui_download_window_done(), and gui_download_window::result.

Here is the call graph for this function:

◆ gui_window_save_link()

nserror gui_window_save_link ( struct gui_window g,
nsurl url,
const char *  title 
)

Definition at line 428 of file download.c.

References ami_download_check_overwrite(), ami_gui_get_gui_window_2(), ami_gui_get_screen(), ami_gui_get_window(), ami_reset_pointer(), ami_set_pointer(), ASPrintf(), FClose, FOpen, GUI_POINTER_WAIT, messages_get(), NSERROR_OK, nsurl_access(), and savereq.

Here is the call graph for this function:

Variable Documentation

◆ ami_download_table

const struct ami_win_event_table ami_download_table
static
Initial value:
= {
}
static BOOL ami_download_window_event(void *w)
Definition: download.c:380
static void ami_download_window_abort(void *w)
Definition: download.c:372

Definition at line 117 of file download.c.

Referenced by gui_download_window_create().

◆ amiga_download_table

struct gui_download_table* amiga_download_table = &download_table

Definition at line 534 of file download.c.

Referenced by main().

◆ download_table

struct gui_download_table download_table
static
Initial value:
= {
}
static nserror gui_download_window_data(struct gui_download_window *dw, const char *data, unsigned int size)
Definition: download.c:245
static struct gui_download_window * gui_download_window_create(download_context *ctx, struct gui_window *gui)
Definition: download.c:124
static void gui_download_window_error(struct gui_download_window *dw, const char *error_msg)
Definition: download.c:364
static void gui_download_window_done(struct gui_download_window *dw)
Definition: download.c:293

Definition at line 527 of file download.c.

◆ downloads_in_progress

int downloads_in_progress = 0
static

Definition at line 122 of file download.c.

Referenced by gui_download_window_create(), and gui_download_window_done().