NetSurf
Data Structures | Macros | Enumerations | Functions | Variables
download.c File Reference

RISC OS download windows implementation. More...

#include <assert.h>
#include <string.h>
#include <time.h>
#include <libwapcaplet/libwapcaplet.h>
#include "oslib/mimemap.h"
#include "oslib/osargs.h"
#include "oslib/osfile.h"
#include "oslib/osfind.h"
#include "oslib/osfscontrol.h"
#include "oslib/osgbpb.h"
#include "oslib/wimp.h"
#include "oslib/wimpspriteop.h"
#include "utils/sys_time.h"
#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/nsurl.h"
#include "utils/utf8.h"
#include "utils/utils.h"
#include "utils/url.h"
#include "utils/corestrings.h"
#include "netsurf/download.h"
#include "desktop/download.h"
#include "riscos/gui.h"
#include "riscos/dialog.h"
#include "riscos/mouse.h"
#include "riscos/save.h"
#include "riscos/query.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
#include "riscos/ucstables.h"
#include "riscos/filetype.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 ICON_DOWNLOAD_ICON   0
 
#define ICON_DOWNLOAD_URL   1
 
#define ICON_DOWNLOAD_PATH   2
 
#define ICON_DOWNLOAD_DESTINATION   3
 
#define ICON_DOWNLOAD_PROGRESS   5
 
#define ICON_DOWNLOAD_STATUS   6
 
#define RO_DOWNLOAD_MAX_PATH_LEN   255
 

Enumerations

enum  query_reason { QueryRsn_Quit , QueryRsn_Abort , QueryRsn_Overwrite }
 

Functions

static void ro_gui_download_drag_end (wimp_dragged *drag, void *data)
 Handle User_Drag_Box event for a drag from a download window. More...
 
static const char * ro_gui_download_temp_name (struct gui_download_window *dw)
 Returns the pathname of a temporary file for this download. More...
 
static void ro_gui_download_update_status (struct gui_download_window *dw)
 Update the status text and progress bar. More...
 
static void ro_gui_download_update_status_wrapper (void *p)
 Wrapper for ro_gui_download_update_status(), suitable for riscos_schedule(). More...
 
static void ro_gui_download_window_hide_caret (struct gui_download_window *dw)
 Hide the caret but preserve input focus. More...
 
static char * ro_gui_download_canonicalise (const char *path)
 Return a pathname in canonical form. More...
 
static bool ro_gui_download_check_space (struct gui_download_window *dw, const char *dest_file, const char *orig_file)
 Check the available space on the medium containing the destination file, taking into account any space currently occupied by the file at its original location. More...
 
static os_error * ro_gui_download_move (struct gui_download_window *dw, const char *dest_file, const char *src_file)
 Move the downloading file to a new location and continue downloading there. More...
 
static void ro_gui_download_remember_dir (const char *path)
 Remember the directory containing the given file, for use in further downloads. More...
 
static bool ro_gui_download_save (struct gui_download_window *dw, const char *file_name, bool force_overwrite)
 Start of save operation, user has specified where the file should be saved. More...
 
static void ro_gui_download_send_dataload (struct gui_download_window *dw)
 Send DataLoad message in response to DataSaveAck, informing the target application that the transfer is complete. More...
 
static void ro_gui_download_window_destroy_wrapper (void *p)
 Wrapper for ro_gui_download_window_destroy(), suitable for riscos_schedule(). More...
 
static bool ro_gui_download_window_destroy (struct gui_download_window *dw, bool quit)
 Close a download window and free any related resources. More...
 
static void ro_gui_download_close_confirmed (query_id id, enum query_response res, void *p)
 Download aborted, close window and tidy up. More...
 
static void ro_gui_download_close_cancelled (query_id id, enum query_response res, void *p)
 User has opted to cancel the close, leaving the download to continue. More...
 
static void ro_gui_download_overwrite_confirmed (query_id id, enum query_response res, void *p)
 Overwrite of existing file confirmed, proceed with the save. More...
 
static void ro_gui_download_overwrite_cancelled (query_id id, enum query_response res, void *p)
 User has opted not to overwrite the existing file. More...
 
static bool ro_gui_download_click (wimp_pointer *pointer)
 Handle Mouse_Click events in a download window. More...
 
static bool ro_gui_download_keypress (wimp_key *key)
 Handler Key_Press events in a download window. More...
 
static void ro_gui_download_close (wimp_w w)
 Handle closing of download window. More...
 
void ro_gui_download_init (void)
 Load the download window template. More...
 
static nserror download_ro_filetype (download_context *ctx, bits *ftype_out)
 Try and find the correct RISC OS filetype from a download context. More...
 
static struct gui_download_windowgui_download_window_create (download_context *ctx, struct gui_window *gui)
 Create and open a download progress window. More...
 
static void gui_download_window_error (struct gui_download_window *dw, const char *error_msg)
 Handle failed downloads. More...
 
static nserror gui_download_window_data (struct gui_download_window *dw, const char *data, unsigned int size)
 Handle received download data. More...
 
static void gui_download_window_done (struct gui_download_window *dw)
 Handle completed downloads. More...
 
void ro_gui_download_datasave_ack (wimp_message *message)
 Handle Message_DataSaveAck for a drag from a download window. More...
 
bool ro_gui_download_prequit (void)
 Respond to PreQuit message, displaying a prompt message if we need the user to confirm the shutdown. More...
 

Variables

static struct gui_download_windowdownload_window_list = 0
 List of all download windows. More...
 
static struct gui_download_windowdownload_window_current = 0
 Download window with current save operation. More...
 
static wimp_window * download_template
 Template for a download window. More...
 
static int download_progress_width
 Width of progress bar at 100%. More...
 
static int download_progress_x0
 Coordinates of progress bar. More...
 
static int download_progress_y0
 
static int download_progress_y1
 
static char * download_dir = NULL
 Current download directory. More...
 
static size_t download_dir_len
 
static const query_callback close_funcs
 
static const query_callback overwrite_funcs
 
static struct gui_download_table download_table
 
struct gui_download_tableriscos_download_table = &download_table
 

Detailed Description

RISC OS download windows implementation.

This file implements the interface given by netsurf/download.h for download windows. Each download window has an associated fetch. Downloads start by writing received data to a temporary file. At some point the user chooses a destination (by drag & drop), and the temporary file is then moved to the destination and the download continues until complete.

Definition in file download.c.

Macro Definition Documentation

◆ ICON_DOWNLOAD_DESTINATION

#define ICON_DOWNLOAD_DESTINATION   3

Definition at line 73 of file download.c.

◆ ICON_DOWNLOAD_ICON

#define ICON_DOWNLOAD_ICON   0

Definition at line 70 of file download.c.

◆ ICON_DOWNLOAD_PATH

#define ICON_DOWNLOAD_PATH   2

Definition at line 72 of file download.c.

◆ ICON_DOWNLOAD_PROGRESS

#define ICON_DOWNLOAD_PROGRESS   5

Definition at line 74 of file download.c.

◆ ICON_DOWNLOAD_STATUS

#define ICON_DOWNLOAD_STATUS   6

Definition at line 75 of file download.c.

◆ ICON_DOWNLOAD_URL

#define ICON_DOWNLOAD_URL   1

Definition at line 71 of file download.c.

◆ RO_DOWNLOAD_MAX_PATH_LEN

#define RO_DOWNLOAD_MAX_PATH_LEN   255

Definition at line 77 of file download.c.

Enumeration Type Documentation

◆ query_reason

Enumerator
QueryRsn_Quit 
QueryRsn_Abort 
QueryRsn_Overwrite 

Definition at line 79 of file download.c.

Function Documentation

◆ download_ro_filetype()

static nserror download_ro_filetype ( download_context ctx,
bits *  ftype_out 
)
static

Try and find the correct RISC OS filetype from a download context.

Definition at line 222 of file download.c.

References gui_download_window::ctx, download_context_get_mime_type(), download_context_get_url(), gui_download_window::error, NSERROR_OK, NSLOG, nsurl_get_component(), NSURL_PATH, NSURL_SCHEME, path(), ro_filetype_from_unix_path(), ro_warn_user(), gui_download_window::url, and url_unescape().

Referenced by gui_download_window_create().

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

Create and open a download progress window.

Parameters
ctxDownload context
guiThe RISCOS gui window to download for.
Returns
A new gui_download_window structure, or NULL on error and error reported
Todo:
change this to take a reference to the nsurl and use that value directly rather than using a fixed buffer.

Definition at line 287 of file download.c.

References gui_download_window::average_points, gui_download_window::average_rate, gui_download_window::close_confirmed, gui_download_window::ctx, download_context_get_filename(), download_context_get_total_length(), download_context_get_url(), download_dir, download_ro_filetype(), download_template, download_window_list, gui_download_window::error, gui_download_window::file, gui_download_window::file_type, gui_download_window::filename, ICON_DOWNLOAD_DESTINATION, ICON_DOWNLOAD_ICON, ICON_DOWNLOAD_PATH, ICON_DOWNLOAD_STATUS, ICON_DOWNLOAD_URL, gui_download_window::last_received, gui_download_window::last_time, messages_get(), messages_get_errorcode(), gui_download_window::next, NSERROR_BAD_ENCODING, NSERROR_OK, NSLOG, nsoption_bool, nsurl_access(), gui_download_window::path, gui_download_window::prev, gui_download_window::query, QUERY_INVALID, gui_download_window::received, RO_DOWNLOAD_MAX_PATH_LEN, ro_gui_dialog_open(), ro_gui_download_check_space(), ro_gui_download_click(), ro_gui_download_close(), ro_gui_download_keypress(), ro_gui_download_temp_name(), ro_gui_download_update_status(), ro_gui_wimp_event_register_close_window(), ro_gui_wimp_event_register_keypress(), ro_gui_wimp_event_register_mouse_click(), ro_gui_wimp_event_set_user_data(), ro_gui_wimp_sprite_exists(), ro_warn_user(), gui_download_window::saved, gui_download_window::size, gui_download_window::sprite_name, gui_download_window::start_time, gui_download_window::status, text(), gui_download_window::total_size, gui_download_window::url, utf8_to_local_encoding(), and gui_download_window::window.

Here is the call graph for this function:

◆ gui_download_window_data()

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

Handle received download data.

Parameters
dwdownload window
datapointer to block of data received
sizesize of data
Returns
NSERROR_OK on success, appropriate error otherwise

Definition at line 530 of file download.c.

References gui_download_window::ctx, download_context_abort(), gui_download_window::error, gui_download_window::file, gui_download_window_error(), ICON_DOWNLOAD_DESTINATION, ICON_DOWNLOAD_ICON, ICON_DOWNLOAD_PATH, messages_get(), NSERROR_OK, NSERROR_SAVE_FAILED, NSLOG, gui_download_window::path, gui_download_window::received, ro_gui_download_move(), ro_gui_download_temp_name(), ro_warn_user(), gui_download_window::saved, gui_download_window::size, and gui_download_window::window.

Here is the call graph for this function:

◆ gui_download_window_done()

static void gui_download_window_done ( struct gui_download_window dw)
static

Handle completed downloads.

Parameters
dwdownload window

Definition at line 810 of file download.c.

References gui_download_window::ctx, download_context_destroy(), gui_download_window::file, gui_download_window::file_type, NSLOG, gui_download_window::path, riscos_schedule(), ro_gui_download_send_dataload(), ro_gui_download_update_status(), ro_gui_download_window_destroy_wrapper(), ro_warn_user(), gui_download_window::saved, and gui_download_window::send_dataload.

Here is the call graph for this function:

◆ gui_download_window_error()

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

Handle failed downloads.

Parameters
dwdownload window
error_msgerror message

Definition at line 475 of file download.c.

References gui_download_window::ctx, download_context_destroy(), gui_download_window::error, ICON_DOWNLOAD_ICON, ICON_DOWNLOAD_PATH, ICON_DOWNLOAD_STATUS, NSLOG, riscos_schedule(), ro_gui_download_update_status_wrapper(), ro_gui_download_window_hide_caret(), ro_warn_user(), gui_download_window::status, and gui_download_window::window.

Referenced by gui_download_window_data(), and ro_gui_download_save().

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

◆ ro_gui_download_canonicalise()

char * ro_gui_download_canonicalise ( const char *  path)
static

Return a pathname in canonical form.

Parameters
pathpathnamee to be canonicalised
Returns
ptr to pathname in malloc block, or NULL

Definition at line 1040 of file download.c.

References gui_download_window::error, NSLOG, and path().

Referenced by ro_gui_download_check_space().

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

◆ ro_gui_download_check_space()

bool ro_gui_download_check_space ( struct gui_download_window dw,
const char *  dest_file,
const char *  orig_file 
)
static

Check the available space on the medium containing the destination file, taking into account any space currently occupied by the file at its original location.

Parameters
dwdownload window
dest_filedestination pathname
orig_filecurrent pathname, NULL if no existing file
Returns
true iff there's enough space

Definition at line 1085 of file download.c.

References gui_download_window::error, gui_download_window::file, min, NSLOG, ro_gui_download_canonicalise(), and gui_download_window::total_size.

Referenced by gui_download_window_create(), and ro_gui_download_save().

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

◆ ro_gui_download_click()

bool ro_gui_download_click ( wimp_pointer *  pointer)
static

Handle Mouse_Click events in a download window.

Parameters
pointerblock returned by Wimp_Poll

Definition at line 851 of file download.c.

References download_window_current, gui_download_window::error, ICON_DOWNLOAD_DESTINATION, ICON_DOWNLOAD_ICON, NSLOG, gui_download_window::path, ro_gui_download_drag_end(), ro_gui_drag_icon(), ro_gui_get_icon_string(), ro_gui_wimp_event_get_user_data(), ro_mouse_drag_start(), ro_warn_user(), and gui_download_window::saved.

Referenced by gui_download_window_create().

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

◆ ro_gui_download_close()

void ro_gui_download_close ( wimp_w  w)
static

Handle closing of download window.

Definition at line 1479 of file download.c.

References ro_gui_download_window_destroy(), ro_gui_wimp_event_get_user_data(), and gui_download_window::w.

Referenced by gui_download_window_create().

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

◆ ro_gui_download_close_cancelled()

void ro_gui_download_close_cancelled ( query_id  id,
enum query_response  res,
void *  p 
)
static

User has opted to cancel the close, leaving the download to continue.

Definition at line 1607 of file download.c.

References gui_download_window::query, and QUERY_INVALID.

◆ ro_gui_download_close_confirmed()

void ro_gui_download_close_confirmed ( query_id  id,
enum query_response  res,
void *  p 
)
static

Download aborted, close window and tidy up.

Definition at line 1618 of file download.c.

References gui_download_window::close_confirmed, download_window_list, gui_download_window::query, QUERY_INVALID, gui_download_window::query_rsn, QueryRsn_Quit, riscos_done, ro_gui_download_window_destroy(), ro_gui_download_window_destroy_wrapper(), and ro_gui_prequit().

Here is the call graph for this function:

◆ ro_gui_download_datasave_ack()

void ro_gui_download_datasave_ack ( wimp_message *  message)

Handle Message_DataSaveAck for a drag from a download window.

Parameters
messageblock returned by Wimp_Poll

Definition at line 1010 of file download.c.

References gui_download_window::ctx, download_window_current, nsoption_bool, riscos_schedule(), ro_gui_download_save(), ro_gui_download_send_dataload(), ro_gui_download_window_destroy_wrapper(), gui_download_window::save_message, and gui_download_window::send_dataload.

Referenced by ro_msg_datasave_ack().

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

◆ ro_gui_download_drag_end()

static void ro_gui_download_drag_end ( wimp_dragged *  drag,
void *  data 
)
static

Handle User_Drag_Box event for a drag from a download window.

Parameters
*dragblock returned by Wimp_Poll
*dataNULL data to allow use as callback from ro_mouse.

Definition at line 949 of file download.c.

References download_window_current, gui_download_window::error, gui_download_window::file_type, gui_current_drag_type, GUI_DRAG_DOWNLOAD_SAVE, NSLOG, gui_download_window::path, gui_download_window::received, ro_gui_convert_save_path(), ro_warn_user(), gui_download_window::saved, gui_download_window::total_size, and gui_download_window::window.

Referenced by ro_gui_download_click().

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

◆ ro_gui_download_init()

void ro_gui_download_init ( void  )

Load the download window template.

Definition at line 189 of file download.c.

References download_progress_width, download_progress_x0, download_progress_y0, download_progress_y1, download_template, ICON_DOWNLOAD_PROGRESS, ICON_DOWNLOAD_STATUS, and ro_gui_dialog_load_template().

Referenced by gui_init().

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

◆ ro_gui_download_keypress()

bool ro_gui_download_keypress ( wimp_key *  key)
static

Handler Key_Press events in a download window.

Parameters
keykey press returned by Wimp_Poll
Returns
true iff key press handled

Definition at line 905 of file download.c.

References gui_download_window::ctx, ICON_DOWNLOAD_PATH, gui_download_window::name, nsoption_bool, gui_download_window::path, riscos_schedule(), ro_gui_convert_save_path(), ro_gui_download_save(), ro_gui_download_window_destroy(), ro_gui_download_window_destroy_wrapper(), ro_gui_get_icon_string(), ro_gui_wimp_event_get_user_data(), ro_warn_user(), gui_download_window::send_dataload, and gui_download_window::window.

Referenced by gui_download_window_create().

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

◆ ro_gui_download_move()

os_error * ro_gui_download_move ( struct gui_download_window dw,
const char *  dest_file,
const char *  src_file 
)
static

Move the downloading file to a new location and continue downloading there.

Parameters
dwdownload window
dest_filenew location
src_fileold location
Returns
error iff failed to move file

Definition at line 1187 of file download.c.

References gui_download_window::ctx, gui_download_window::error, gui_download_window::file, gui_download_window::file_type, NSLOG, gui_download_window::received, and ro_warn_user().

Referenced by gui_download_window_data(), and ro_gui_download_save().

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

◆ ro_gui_download_overwrite_cancelled()

void ro_gui_download_overwrite_cancelled ( query_id  id,
enum query_response  res,
void *  p 
)
static

User has opted not to overwrite the existing file.

Definition at line 1642 of file download.c.

References gui_download_window::query, and QUERY_INVALID.

◆ ro_gui_download_overwrite_confirmed()

void ro_gui_download_overwrite_confirmed ( query_id  id,
enum query_response  res,
void *  p 
)
static

Overwrite of existing file confirmed, proceed with the save.

Definition at line 1653 of file download.c.

References gui_download_window::ctx, gui_download_window::query, QUERY_INVALID, riscos_schedule(), ro_gui_download_save(), ro_gui_download_send_dataload(), ro_gui_download_window_destroy_wrapper(), and gui_download_window::save_message.

Here is the call graph for this function:

◆ ro_gui_download_prequit()

bool ro_gui_download_prequit ( void  )

Respond to PreQuit message, displaying a prompt message if we need the user to confirm the shutdown.

Returns
true if we can shutdown straightaway

Definition at line 1680 of file download.c.

References download_window_list, and ro_gui_download_window_destroy().

Referenced by ro_gui_prequit().

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

◆ ro_gui_download_remember_dir()

void ro_gui_download_remember_dir ( const char *  path)
static

Remember the directory containing the given file, for use in further downloads.

Parameters
pathpathname of downloaded file
Returns
none

Definition at line 1276 of file download.c.

References download_dir, download_dir_len, and path().

Referenced by ro_gui_download_save().

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

◆ ro_gui_download_save()

bool ro_gui_download_save ( struct gui_download_window dw,
const char *  file_name,
bool  force_overwrite 
)
static

Start of save operation, user has specified where the file should be saved.

Parameters
dwdownload window
file_namepathname of destination file &
force_overwritetrue iff required to overwrite without prompting
Returns
true iff save successfully initiated

Definition at line 1312 of file download.c.

References gui_download_window::ctx, download_context_abort(), gui_download_window::error, gui_download_window::file, gui_download_window_error(), ICON_DOWNLOAD_DESTINATION, ICON_DOWNLOAD_ICON, ICON_DOWNLOAD_PATH, messages_get(), NSLOG, overwrite_funcs, gui_download_window::path, gui_download_window::query, gui_download_window::query_rsn, query_user(), QueryRsn_Overwrite, gui_download_window::received, ro_gui_download_check_space(), ro_gui_download_move(), ro_gui_download_remember_dir(), ro_gui_download_temp_name(), ro_gui_download_window_hide_caret(), ro_gui_force_redraw_icon(), ro_warn_user(), gui_download_window::save_message, gui_download_window::saved, gui_download_window::send_dataload, and gui_download_window::window.

Referenced by ro_gui_download_datasave_ack(), ro_gui_download_keypress(), and ro_gui_download_overwrite_confirmed().

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

◆ ro_gui_download_send_dataload()

void ro_gui_download_send_dataload ( struct gui_download_window dw)
static

Send DataLoad message in response to DataSaveAck, informing the target application that the transfer is complete.

Parameters
dwdownload window

Definition at line 1438 of file download.c.

References gui_download_window::error, NSLOG, riscos_schedule(), ro_gui_download_window_destroy_wrapper(), ro_warn_user(), gui_download_window::save_message, and gui_download_window::send_dataload.

Referenced by gui_download_window_done(), ro_gui_download_datasave_ack(), and ro_gui_download_overwrite_confirmed().

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

◆ ro_gui_download_temp_name()

const char * ro_gui_download_temp_name ( struct gui_download_window dw)
static

Returns the pathname of a temporary file for this download.

Parameters
dwdownload window
Returns
ptr to pathname

Definition at line 211 of file download.c.

Referenced by gui_download_window_create(), gui_download_window_data(), ro_gui_download_save(), and ro_gui_download_window_destroy().

Here is the caller graph for this function:

◆ ro_gui_download_update_status()

void ro_gui_download_update_status ( struct gui_download_window dw)
static

◆ ro_gui_download_update_status_wrapper()

void ro_gui_download_update_status_wrapper ( void *  p)
static

Wrapper for ro_gui_download_update_status(), suitable for riscos_schedule().

Definition at line 765 of file download.c.

References ro_gui_download_update_status().

Referenced by gui_download_window_error(), ro_gui_download_update_status(), and ro_gui_download_window_destroy().

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

◆ ro_gui_download_window_destroy()

bool ro_gui_download_window_destroy ( struct gui_download_window dw,
bool  quit 
)
static

Close a download window and free any related resources.

Parameters
dwdownload window
quitdestroying because we're quitting the whole app
Returns
true if window destroyed, not waiting for user confirmation

Definition at line 1496 of file download.c.

References gui_download_window::close_confirmed, close_funcs, gui_download_window::ctx, download_context_abort(), download_context_destroy(), download_window_list, gui_download_window::error, gui_download_window::file, gui_download_window::next, NSLOG, gui_download_window::prev, gui_download_window::query, query_close(), QUERY_INVALID, gui_download_window::query_rsn, query_user(), QueryRsn_Abort, QueryRsn_Quit, riscos_schedule(), ro_gui_dialog_open_top(), ro_gui_download_temp_name(), ro_gui_download_update_status_wrapper(), ro_gui_download_window_destroy_wrapper(), ro_gui_query_window_bring_to_front(), ro_gui_wimp_event_finalise(), ro_warn_user(), gui_download_window::saved, and gui_download_window::window.

Referenced by ro_gui_download_close(), ro_gui_download_close_confirmed(), ro_gui_download_keypress(), ro_gui_download_prequit(), and ro_gui_download_window_destroy_wrapper().

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

◆ ro_gui_download_window_destroy_wrapper()

void ro_gui_download_window_destroy_wrapper ( void *  p)
static

Wrapper for ro_gui_download_window_destroy(), suitable for riscos_schedule().

Definition at line 1592 of file download.c.

References gui_download_window::close_confirmed, gui_download_window::query, query_close(), QUERY_INVALID, and ro_gui_download_window_destroy().

Referenced by gui_download_window_done(), ro_gui_download_close_confirmed(), ro_gui_download_datasave_ack(), ro_gui_download_keypress(), ro_gui_download_overwrite_confirmed(), ro_gui_download_send_dataload(), and ro_gui_download_window_destroy().

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

◆ ro_gui_download_window_hide_caret()

void ro_gui_download_window_hide_caret ( struct gui_download_window dw)
static

Hide the caret but preserve input focus.

Parameters
dwdownload window

Definition at line 778 of file download.c.

References NSLOG, ro_warn_user(), and gui_download_window::window.

Referenced by gui_download_window_error(), and ro_gui_download_save().

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

Variable Documentation

◆ close_funcs

const query_callback close_funcs
static
Initial value:
=
{
}
static void ro_gui_download_close_cancelled(query_id, enum query_response res, void *p)
User has opted to cancel the close, leaving the download to continue.
Definition: download.c:1607
static void ro_gui_download_close_confirmed(query_id, enum query_response res, void *p)
Download aborted, close window and tidy up.
Definition: download.c:1618

Definition at line 172 of file download.c.

Referenced by ro_gui_download_window_destroy().

◆ download_dir

char* download_dir = NULL
static

Current download directory.

Definition at line 144 of file download.c.

Referenced by ami_file_req_init(), ami_gui_opts_open(), ami_gui_opts_use(), gui_download_window_create(), and ro_gui_download_remember_dir().

◆ download_dir_len

size_t download_dir_len
static

Definition at line 145 of file download.c.

Referenced by ro_gui_download_remember_dir().

◆ download_progress_width

int download_progress_width
static

Width of progress bar at 100%.

Definition at line 137 of file download.c.

Referenced by ro_gui_download_init(), and ro_gui_download_update_status().

◆ download_progress_x0

int download_progress_x0
static

Coordinates of progress bar.

Definition at line 139 of file download.c.

Referenced by ro_gui_download_init(), and ro_gui_download_update_status().

◆ download_progress_y0

int download_progress_y0
static

Definition at line 140 of file download.c.

Referenced by ro_gui_download_init(), and ro_gui_download_update_status().

◆ download_progress_y1

int download_progress_y1
static

Definition at line 141 of file download.c.

Referenced by ro_gui_download_init(), and ro_gui_download_update_status().

◆ 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)
Handle received download data.
Definition: download.c:530
static struct gui_download_window * gui_download_window_create(download_context *ctx, struct gui_window *gui)
Create and open a download progress window.
Definition: download.c:287
static void gui_download_window_error(struct gui_download_window *dw, const char *error_msg)
Handle failed downloads.
Definition: download.c:475
static void gui_download_window_done(struct gui_download_window *dw)
Handle completed downloads.
Definition: download.c:810

Definition at line 1690 of file download.c.

◆ download_template

wimp_window* download_template
static

Template for a download window.

Definition at line 134 of file download.c.

Referenced by gui_download_window_create(), and ro_gui_download_init().

◆ download_window_current

struct gui_download_window* download_window_current = 0
static

Download window with current save operation.

Definition at line 131 of file download.c.

Referenced by ro_gui_download_click(), ro_gui_download_datasave_ack(), and ro_gui_download_drag_end().

◆ download_window_list

struct gui_download_window* download_window_list = 0
static

◆ overwrite_funcs

const query_callback overwrite_funcs
static
Initial value:
=
{
}
static void ro_gui_download_overwrite_confirmed(query_id, enum query_response res, void *p)
Overwrite of existing file confirmed, proceed with the save.
Definition: download.c:1653
static void ro_gui_download_overwrite_cancelled(query_id, enum query_response res, void *p)
User has opted not to overwrite the existing file.
Definition: download.c:1642

Definition at line 178 of file download.c.

Referenced by ro_gui_download_save().

◆ riscos_download_table

struct gui_download_table* riscos_download_table = &download_table

Definition at line 1697 of file download.c.

Referenced by main().