diff options
author | Ole Loots <ole@monochrom.net> | 2012-03-11 15:42:41 +0000 |
---|---|---|
committer | Ole Loots <ole@monochrom.net> | 2012-03-11 15:42:41 +0000 |
commit | b01229d9cc8d65e40b6a124b307d9dca57d65604 (patch) | |
tree | ee00ed6f63df3254aed8196f628fb0e0b3e6c80c /atari/download.c | |
parent | cf86788d3e7b6069b46090da7eaad143892c80d5 (diff) | |
download | netsurf-b01229d9cc8d65e40b6a124b307d9dca57d65604.tar.gz netsurf-b01229d9cc8d65e40b6a124b307d9dca57d65604.tar.bz2 |
now abort button becomes close button when download is completed.
svn path=/trunk/netsurf/; revision=13510
Diffstat (limited to 'atari/download.c')
-rwxr-xr-x | atari/download.c | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/atari/download.c b/atari/download.c index c83207227..b290774f9 100755 --- a/atari/download.c +++ b/atari/download.c @@ -64,8 +64,12 @@ static void __CDECL evnt_bt_abort_click {
struct gui_download_window * dw = (struct gui_download_window *)data;
assert( dw != NULL );
- ObjcChange( OC_FORM, win, index, ~SELECTED, TRUE);
- if( dw->status != NSATARI_DOWNLOAD_CANCELED ){
+ ObjcChange( OC_FORM, win, index, ~SELECTED, TRUE); + if( dw->status == NSATARI_DOWNLOAD_COMPLETE + || dw->status == NSATARI_DOWNLOAD_ERROR ) { + ApplWrite( _AESapid, WM_CLOSED, win->handle, 0,0,0,0); + }
+ else if( dw->status != NSATARI_DOWNLOAD_CANCELED ){
dw->abort = true;
}
}
@@ -297,28 +301,35 @@ void gui_download_window_error(struct gui_download_window *dw, }
void gui_download_window_done(struct gui_download_window *dw)
-{
- LOG((""));
- dw->status = NSATARI_DOWNLOAD_COMPLETE;
+{ + OBJECT * tree;
+ LOG(("")); +
+ dw->status = NSATARI_DOWNLOAD_COMPLETE; +
if( dw->fd != NULL ) {
fclose( dw->fd );
dw->fd = NULL;
}
- OBJECT * tree = ObjcTree(OC_FORM, dw->form );
- tree[DOWNLOAD_PROGRESS_DONE].ob_width = DOWNLOAD_BAR_MAX;
- snprintf( (char*)&dw->lbl_percent, MAX_SLEN_LBL_PERCENT,
- "%lu%s", 100, "%"
- );
- snprintf( (char*)&dw->lbl_done, MAX_SLEN_LBL_DONE, "%s / %s",
- human_friendly_bytesize(dw->size_downloaded),
- (dw->size_total>0) ? human_friendly_bytesize(dw->size_total) : human_friendly_bytesize(dw->size_downloaded)
- );
- ObjcString( tree, DOWNLOAD_LBL_BYTES, (char*)&dw->lbl_done );
- ObjcString( tree, DOWNLOAD_LBL_PERCENT, (char*)&dw->lbl_percent );
- ObjcChange( OC_FORM, dw->form, DOWNLOAD_BT_ABORT, DISABLED, FALSE);
- snd_rdw( dw->form );
+ + + tree = ObjcTree(OC_FORM, dw->form ); +
if( (tree[DOWNLOAD_CB_CLOSE_RDY].ob_state & SELECTED) != 0 ) {
ApplWrite( _AESapid, WM_CLOSED, dw->form->handle, 0,0,0,0);
+ } else {
+ tree[DOWNLOAD_PROGRESS_DONE].ob_width = DOWNLOAD_BAR_MAX;
+ snprintf( (char*)&dw->lbl_percent, MAX_SLEN_LBL_PERCENT,
+ "%lu%s", 100, "%"
+ );
+ snprintf( (char*)&dw->lbl_done, MAX_SLEN_LBL_DONE, "%s / %s",
+ human_friendly_bytesize(dw->size_downloaded),
+ (dw->size_total>0) ? human_friendly_bytesize(dw->size_total) : human_friendly_bytesize(dw->size_downloaded)
+ ); + ObjcString( tree, DOWNLOAD_LBL_BYTES, (char*)&dw->lbl_done );
+ ObjcString( tree, DOWNLOAD_LBL_PERCENT, (char*)&dw->lbl_percent ); + ObjcString( tree, DOWNLOAD_BT_ABORT, (char*)"Close" );
+ snd_rdw( dw->form ); } gui_window_set_status(input_window, messages_get("Done") );
}
|