From b85f92c3fe82a5c557d52af9a87912e7e91cd821 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Mon, 13 Apr 2009 20:26:01 +0400 Subject: [PATCH] Small redesign of status dialog of directory size calculation. src/smd.c (single_dirsize_cmd): create status dialog if needed not always. file.h: fixed typo. file.c (compute_dir_size_create_ui): changed title of dialog. (compute_dir_size_destroy_ui): formatting. (compute_dir_size_update_ui): simplified text of dialog. --- src/cmd.c | 4 ++-- src/file.c | 13 +++++-------- src/file.h | 2 +- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/cmd.c b/src/cmd.c index fa9965030..786ea6079 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1199,10 +1199,10 @@ single_dirsize_cmd (void) double total; ComputeDirSizeUI *ui; - ui = compute_dir_size_create_ui (); - entry = &(panel->dir.list[panel->selected]); if (S_ISDIR (entry->st.st_mode) && strcmp(entry->fname, "..") != 0) { + ui = compute_dir_size_create_ui (); + total = 0.0; if (compute_dir_size (entry->fname, ui, compute_dir_size_update_ui, diff --git a/src/file.c b/src/file.c index 1130a4cdd..3ba2248e8 100644 --- a/src/file.c +++ b/src/file.c @@ -1489,7 +1489,7 @@ compute_dir_size_create_ui (void) ui = g_new (ComputeDirSizeUI, 1); ui->dlg = create_dlg (0, 0, 8, COLS/2, dialog_colors, NULL, - NULL, _("Directory size"), DLG_CENTER | DLG_TRYUP); + NULL, _("Directory scanning"), DLG_CENTER); ui->dirname = label_new (3, 3, ""); add_widget (ui->dlg, ui->dirname); @@ -1497,7 +1497,7 @@ compute_dir_size_create_ui (void) button_new (5, (ui->dlg->cols - strlen (b_name))/2, FILE_ABORT, NORMAL_BUTTON, b_name, NULL)); - /* We will manage the dialog without any help, + /* We will manage the dialog without any help, that's why we have to call init_dlg */ init_dlg (ui->dlg); @@ -1508,10 +1508,10 @@ void compute_dir_size_destroy_ui (ComputeDirSizeUI *ui) { if (ui != NULL) { - /* schedule to update passive panel */ + /* schedule to update passive panel */ other_panel->dirty = 1; - /* close and destroy dialog */ + /* close and destroy dialog */ dlg_run_done (ui->dlg); destroy_dlg (ui->dlg); g_free (ui); @@ -1522,16 +1522,13 @@ FileProgressStatus compute_dir_size_update_ui (const void *ui, const char *dirname) { const ComputeDirSizeUI *this = (const ComputeDirSizeUI *) ui; - char *msg; int c; Gpm_Event event; if (ui == NULL) return FILE_CONT; - msg = g_strdup_printf (_("Scanning: %s"), dirname); - label_set_text (this->dirname, name_trunc (msg, this->dlg->cols - 6)); - g_free (msg); + label_set_text (this->dirname, name_trunc (dirname, this->dlg->cols - 6)); event.x = -1; /* Don't show the GPM cursor */ c = get_event (&event, 0, 0); diff --git a/src/file.h b/src/file.h index 82a45a077..0e500853e 100644 --- a/src/file.h +++ b/src/file.h @@ -39,7 +39,7 @@ FileProgressStatus compute_dir_size (const char *dirname, const void *ui, compute_dir_size_callback cback, off_t *ret_marked, double *ret_total); -/* status dialog of durectory size computing */ +/* status dialog of directory size computing */ typedef struct { Dlg_head *dlg; WLabel *dirname;