Commit b6fec63006df1157a7e55acdc39d39b3684a156f
1 parent
d033acda
Exists in
master
and in
5 other branches
Corrigindo timeout invalido durante a transferência de arquivos VM/CMS.
Showing
2 changed files
with
35 additions
and
22 deletions
Show diff stats
locale/pw3270.pot
| ... | ... | @@ -9,7 +9,7 @@ msgstr "" |
| 9 | 9 | "#-#-#-#-# lib3270.pot (PACKAGE VERSION) #-#-#-#-#\n" |
| 10 | 10 | "Project-Id-Version: PACKAGE VERSION\n" |
| 11 | 11 | "Report-Msgid-Bugs-To: \n" |
| 12 | -"POT-Creation-Date: 2018-01-15 14:26-0200\n" | |
| 12 | +"POT-Creation-Date: 2018-02-14 15:16-0200\n" | |
| 13 | 13 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
| 14 | 14 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
| 15 | 15 | "Language-Team: LANGUAGE <LL@li.org>\n" |
| ... | ... | @@ -20,7 +20,7 @@ msgstr "" |
| 20 | 20 | "#-#-#-#-# pw3270.pot (PACKAGE VERSION) #-#-#-#-#\n" |
| 21 | 21 | "Project-Id-Version: PACKAGE VERSION\n" |
| 22 | 22 | "Report-Msgid-Bugs-To: \n" |
| 23 | -"POT-Creation-Date: 2018-01-15 14:26-0200\n" | |
| 23 | +"POT-Creation-Date: 2018-02-14 15:16-0200\n" | |
| 24 | 24 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
| 25 | 25 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
| 26 | 26 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
src/pw3270/v3270ft/v3270ftprogress.c
| ... | ... | @@ -497,43 +497,54 @@ void v3270ftprogress_update(GtkWidget *widget, unsigned long current, unsigned l |
| 497 | 497 | gchar * text; |
| 498 | 498 | v3270ftprogress * dialog = GTK_V3270FTPROGRESS(widget); |
| 499 | 499 | |
| 500 | - if(current && total) { | |
| 500 | + if(current) { | |
| 501 | 501 | |
| 502 | - if(dialog->pulse) { | |
| 503 | - g_source_destroy(dialog->pulse); | |
| 504 | - dialog->pulse = NULL; | |
| 505 | - } | |
| 502 | + // Tem dados, atualiza | |
| 503 | + dialog->timeout = time(NULL) + 10; | |
| 506 | 504 | |
| 507 | - double remaining = ((double) (total - current))/1024.0; | |
| 505 | + if(total) { | |
| 508 | 506 | |
| 509 | - if(remaining > 0 && kbytes_sec > 0) { | |
| 507 | + if(dialog->pulse) { | |
| 508 | + g_source_destroy(dialog->pulse); | |
| 509 | + dialog->pulse = NULL; | |
| 510 | + } | |
| 510 | 511 | |
| 511 | - char buffer[40]; | |
| 512 | - double seconds = ((double) remaining) / kbytes_sec; | |
| 513 | - time_t eta = time(0) + ((time_t) seconds); | |
| 514 | - strftime(buffer, 39, "%H:%M:%S", localtime(&eta)); | |
| 512 | + double remaining = ((double) (total - current))/1024.0; | |
| 515 | 513 | |
| 516 | - gtk_entry_set_text(dialog->info[PROGRESS_FIELD_ETA],buffer); | |
| 514 | + if(remaining > 0 && kbytes_sec > 0) { | |
| 517 | 515 | |
| 518 | - } else { | |
| 516 | + char buffer[40]; | |
| 517 | + double seconds = ((double) remaining) / kbytes_sec; | |
| 518 | + time_t eta = time(0) + ((time_t) seconds); | |
| 519 | + strftime(buffer, 39, "%H:%M:%S", localtime(&eta)); | |
| 519 | 520 | |
| 520 | - gtk_entry_set_text(dialog->info[PROGRESS_FIELD_ETA],"-"); | |
| 521 | + gtk_entry_set_text(dialog->info[PROGRESS_FIELD_ETA],buffer); | |
| 521 | 522 | |
| 522 | - } | |
| 523 | + } else { | |
| 524 | + | |
| 525 | + gtk_entry_set_text(dialog->info[PROGRESS_FIELD_ETA],"-"); | |
| 526 | + | |
| 527 | + } | |
| 523 | 528 | |
| 524 | - gtk_progress_bar_set_fraction(dialog->progress, ((gdouble) current) / ((gdouble) total)); | |
| 529 | + gtk_progress_bar_set_fraction(dialog->progress, ((gdouble) current) / ((gdouble) total)); | |
| 530 | + | |
| 531 | + } | |
| 525 | 532 | |
| 526 | 533 | } |
| 527 | 534 | |
| 528 | - debug("%s(%lu/%lu)",__FUNCTION__,current,total); | |
| 535 | + debug("%s(current=%lu total=%lu kbytes/sec=%u)",__FUNCTION__,current,total,(unsigned int) kbytes_sec); | |
| 529 | 536 | |
| 530 | 537 | text = g_strdup_printf("%lu",current); |
| 531 | 538 | gtk_entry_set_text(dialog->info[PROGRESS_FIELD_CURRENT],text); |
| 532 | 539 | g_free(text); |
| 533 | 540 | |
| 534 | - text = g_strdup_printf("%lu",total); | |
| 535 | - gtk_entry_set_text(dialog->info[PROGRESS_FIELD_TOTAL],text); | |
| 536 | - g_free(text); | |
| 541 | + if(total) { | |
| 542 | + text = g_strdup_printf("%lu",total); | |
| 543 | + gtk_entry_set_text(dialog->info[PROGRESS_FIELD_TOTAL],text); | |
| 544 | + g_free(text); | |
| 545 | + } else { | |
| 546 | + gtk_entry_set_text(dialog->info[PROGRESS_FIELD_TOTAL],_("N/A")); | |
| 547 | + } | |
| 537 | 548 | |
| 538 | 549 | text = g_strdup_printf("%ld KB/s",(unsigned long) kbytes_sec); |
| 539 | 550 | gtk_entry_set_text(dialog->info[PROGRESS_FIELD_SPEED],text); |
| ... | ... | @@ -689,6 +700,7 @@ static void ft_update(H3270 *hSession, unsigned long current, unsigned long tota |
| 689 | 700 | } |
| 690 | 701 | |
| 691 | 702 | static void ft_running(H3270 *hSession, int is_cut, void *widget) { |
| 703 | + debug("%s",__FUNCTION__); | |
| 692 | 704 | GTK_V3270FTPROGRESS(widget)->timeout = time(NULL)+10; |
| 693 | 705 | } |
| 694 | 706 | |
| ... | ... | @@ -719,6 +731,7 @@ static gboolean do_timer(v3270ftprogress *dialog) { |
| 719 | 731 | |
| 720 | 732 | if(time(NULL) > dialog->timeout) { |
| 721 | 733 | |
| 734 | + debug("%s: Dialog timeout",__FUNCTION__); | |
| 722 | 735 | v3270ftprogress_set_header(GTK_WIDGET(dialog),strerror(ETIMEDOUT)); |
| 723 | 736 | |
| 724 | 737 | stop_pulse(dialog); | ... | ... |