522 DavFileUpload *upload = data; |
522 DavFileUpload *upload = data; |
523 |
523 |
524 update_upload_labels(upload); |
524 update_upload_labels(upload); |
525 } |
525 } |
526 |
526 |
|
527 static void upload_window_closed(UiEvent *event, void *data) { |
|
528 // noop, prevents context destruction |
|
529 } |
527 |
530 |
528 void davbrowser_upload_files(UiObject *ui, DavBrowser *browser, UiFileList files) { |
531 void davbrowser_upload_files(UiObject *ui, DavBrowser *browser, UiFileList files) { |
529 if (!browser->sn) { |
532 if (!browser->sn) { |
530 return; // TODO: error msg |
533 return; // TODO: error msg |
531 } |
534 } |
548 upload->queue = ui_threadpool_create(1); |
551 upload->queue = ui_threadpool_create(1); |
549 |
552 |
550 // create upload progress window |
553 // create upload progress window |
551 cxmutstr wtitle = cx_asprintf("Upload to: %s", ui_get(browser->path)); |
554 cxmutstr wtitle = cx_asprintf("Upload to: %s", ui_get(browser->path)); |
552 UiObject *dialog = ui_simple_window(wtitle.ptr, upload); |
555 UiObject *dialog = ui_simple_window(wtitle.ptr, upload); |
|
556 ui_context_closefunc(dialog->ctx, upload_window_closed, NULL); |
553 free(wtitle.ptr); |
557 free(wtitle.ptr); |
554 upload->dialog = dialog; |
558 upload->dialog = dialog; |
555 ui_window_size(dialog, 550, 120); |
559 ui_window_size(dialog, 550, 120); |
556 upload->progress = ui_double_new(dialog->ctx, NULL); |
560 upload->progress = ui_double_new(dialog->ctx, NULL); |
557 upload->label_top_left = ui_string_new(dialog->ctx, NULL); |
561 upload->label_top_left = ui_string_new(dialog->ctx, NULL); |