minor correction of showfree patch

This commit is contained in:
Jindrich Novy 2006-01-02 13:22:35 +00:00
parent 48322245af
commit 33ba53c6fd

View File

@ -1,5 +1,5 @@
--- mc-4.6.1a/src/screen.c.showfree 2005-12-28 16:49:52.000000000 +0100 --- mc-4.6.1a/src/screen.c.showfree 2006-01-02 12:22:51.000000000 +0100
+++ mc-4.6.1a/src/screen.c 2005-12-28 17:14:45.000000000 +0100 +++ mc-4.6.1a/src/screen.c 2006-01-02 13:44:05.000000000 +0100
@@ -49,6 +49,7 @@ @@ -49,6 +49,7 @@
#define WANT_WIDGETS #define WANT_WIDGETS
#include "main.h" /* the_menubar */ #include "main.h" /* the_menubar */
@ -32,12 +32,12 @@
+ struct stat st; + struct stat st;
+ +
+ /* Don't try to stat non-local fs */ + /* Don't try to stat non-local fs */
+ if (strlen(panel->cwd) >= 2 && panel->cwd[0] == '/' && panel->cwd[1] == '#') + if (!vfs_file_is_local(panel->cwd))
+ return; + return;
+ +
+ if (old_cwd == NULL || strcmp(old_cwd, panel->cwd)) { + if (old_cwd == NULL || strcmp(old_cwd, panel->cwd) == 0) {
+ init_my_statfs(); + init_my_statfs();
+ if (old_cwd != NULL) g_free(old_cwd); + g_free(old_cwd);
+ old_cwd = g_strdup(panel->cwd); + old_cwd = g_strdup(panel->cwd);
+ } + }
+ +
@ -48,7 +48,7 @@
+ char buffer1 [6], buffer2[6], *tmp; + char buffer1 [6], buffer2[6], *tmp;
+ size_trunc_len (buffer1, 5, myfs_stats.avail, 1); + size_trunc_len (buffer1, 5, myfs_stats.avail, 1);
+ size_trunc_len (buffer2, 5, myfs_stats.total, 1); + size_trunc_len (buffer2, 5, myfs_stats.total, 1);
+ tmp = g_strdup_printf (_("%s (%d%%) of %s"), buffer1, myfs_stats.total ? + tmp = g_strdup_printf (_("%s (%d%%) of %s"), buffer1, myfs_stats.total > 0 ?
+ (int)(100 * (double)myfs_stats.avail / myfs_stats.total) : 0, + (int)(100 * (double)myfs_stats.avail / myfs_stats.total) : 0,
+ buffer2); + buffer2);
+ widget_move (&panel->widget, panel->widget.lines-3, panel->widget.cols-2-strlen(tmp)); + widget_move (&panel->widget, panel->widget.lines-3, panel->widget.cols-2-strlen(tmp));