summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOle Loots <ole@monochrom.net>2012-03-11 15:42:41 +0000
committerOle Loots <ole@monochrom.net>2012-03-11 15:42:41 +0000
commitb01229d9cc8d65e40b6a124b307d9dca57d65604 (patch)
treeee00ed6f63df3254aed8196f628fb0e0b3e6c80c
parentcf86788d3e7b6069b46090da7eaad143892c80d5 (diff)
downloadnetsurf-b01229d9cc8d65e40b6a124b307d9dca57d65604.tar.gz
netsurf-b01229d9cc8d65e40b6a124b307d9dca57d65604.tar.bz2
now abort button becomes close button when download is completed.
svn path=/trunk/netsurf/; revision=13510
-rwxr-xr-xatari/download.c47
-rwxr-xr-xatari/download.h3
2 files changed, 31 insertions, 19 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") );
}
diff --git a/atari/download.h b/atari/download.h
index b329c3085..c3fa34af3 100755
--- a/atari/download.h
+++ b/atari/download.h
@@ -22,7 +22,8 @@
#define MAX_SLEN_LBL_DONE 64
#define MAX_SLEN_LBL_PERCENT 5
#define MAX_SLEN_LBL_SPEED 13
-#define MAX_SLEN_LBL_FILE 256
+#define MAX_SLEN_LBL_FILE 256
+#define MAX_SLEN_BT_ABORT 5
#define DOWNLOAD_BAR_MAX 300