- fix the free space widget patch: stat()s filesystem less frequently,
display correct info in all circumstances
This commit is contained in:
parent
33442ae103
commit
b8a906e933
@ -1,5 +1,5 @@
|
|||||||
--- mc-4.6.1a/src/setup.c.showfree 2006-02-23 16:32:18.000000000 +0100
|
--- mc-4.6.1a/src/setup.c.showfree 2006-02-23 16:32:18.000000000 +0100
|
||||||
+++ mc-4.6.1a/src/setup.c 2006-05-17 13:16:47.000000000 +0200
|
+++ mc-4.6.1a/src/setup.c 2006-05-29 09:42:29.000000000 +0200
|
||||||
@@ -134,6 +134,7 @@
|
@@ -134,6 +134,7 @@
|
||||||
{ "show_mini_info", &show_mini_info },
|
{ "show_mini_info", &show_mini_info },
|
||||||
{ "permission_mode", &permission_mode },
|
{ "permission_mode", &permission_mode },
|
||||||
@ -8,19 +8,19 @@
|
|||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
--- mc-4.6.1a/src/screen.c.showfree 2006-05-17 13:16:47.000000000 +0200
|
--- mc-4.6.1a/src/main.c.showfree 2006-05-29 12:41:36.000000000 +0200
|
||||||
+++ mc-4.6.1a/src/screen.c 2006-05-17 13:16:47.000000000 +0200
|
+++ mc-4.6.1a/src/main.c 2006-05-29 13:04:50.000000000 +0200
|
||||||
@@ -49,6 +49,7 @@
|
@@ -61,6 +61,7 @@
|
||||||
#define WANT_WIDGETS
|
#include "listmode.h"
|
||||||
#include "main.h" /* the_menubar */
|
#include "execute.h"
|
||||||
#include "unixcompat.h"
|
#include "ext.h" /* For flush_extension_file() */
|
||||||
+#include "mountlist.h" /* my_statfs */
|
+#include "mountlist.h" /* my_statfs */
|
||||||
|
|
||||||
#define ELEMENTS(arr) ( sizeof(arr) / sizeof((arr)[0]) )
|
/* Listbox for the command history feature */
|
||||||
|
#include "widget.h"
|
||||||
@@ -106,6 +107,12 @@
|
@@ -231,6 +232,12 @@
|
||||||
/* The hook list for the select file function */
|
/* We need to paint it after CONSOLE_RESTORE, see: load_prompt */
|
||||||
Hook *select_file_hook = 0;
|
int update_prompt = 0;
|
||||||
|
|
||||||
+/* Old current working directory for displaying free space */
|
+/* Old current working directory for displaying free space */
|
||||||
+char *old_cwd = NULL;
|
+char *old_cwd = NULL;
|
||||||
@ -28,32 +28,40 @@
|
|||||||
+/* Used to figure out how many free space we have */
|
+/* Used to figure out how many free space we have */
|
||||||
+struct my_statfs myfs_stats;
|
+struct my_statfs myfs_stats;
|
||||||
+
|
+
|
||||||
static cb_ret_t panel_callback (Widget *, widget_msg_t msg, int parm);
|
/* The home directory */
|
||||||
static int panel_event (Gpm_Event *event, void *);
|
const char *home_dir = NULL;
|
||||||
static void paint_frame (WPanel *panel);
|
|
||||||
@@ -851,6 +858,41 @@
|
@@ -402,6 +409,8 @@
|
||||||
standend ();
|
int reload_other = !(force_update & UP_ONLY_CURRENT);
|
||||||
|
WPanel *panel;
|
||||||
|
|
||||||
|
+ show_free_space(current_panel);
|
||||||
|
+
|
||||||
|
update_one_panel (get_current_index (), force_update, current_file);
|
||||||
|
if (reload_other)
|
||||||
|
update_one_panel (get_other_index (), force_update, UP_KEEPSEL);
|
||||||
|
@@ -467,6 +476,37 @@
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+
|
+void
|
||||||
+static void
|
|
||||||
+show_free_space(WPanel *panel)
|
+show_free_space(WPanel *panel)
|
||||||
+{
|
+{
|
||||||
+ struct stat st;
|
+ struct stat st;
|
||||||
+
|
+
|
||||||
+ /* Don't try to stat non-local fs */
|
+ /* Don't try to stat non-local fs */
|
||||||
+ if (!vfs_file_is_local(panel->cwd))
|
+ if (!vfs_file_is_local(panel->cwd) || !free_space)
|
||||||
+ return;
|
+ return;
|
||||||
+
|
+
|
||||||
+ if (old_cwd == NULL || strcmp(old_cwd, panel->cwd) == 0) {
|
+ if (old_cwd == NULL || strcmp(old_cwd, panel->cwd) != 0) {
|
||||||
+ init_my_statfs();
|
+ init_my_statfs();
|
||||||
+ g_free(old_cwd);
|
+ g_free(old_cwd);
|
||||||
+ old_cwd = g_strdup(panel->cwd);
|
+ old_cwd = g_strdup(panel->cwd);
|
||||||
|
+ my_statfs (&myfs_stats, panel->cwd);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ my_statfs (&myfs_stats, panel->cwd);
|
|
||||||
+ st = panel->dir.list [panel->selected].st;
|
+ st = panel->dir.list [panel->selected].st;
|
||||||
+
|
+
|
||||||
+ if (myfs_stats.avail > 0 || myfs_stats.total > 0) {
|
+ if (myfs_stats.avail > 0 || myfs_stats.total > 0) {
|
||||||
+ 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);
|
||||||
@ -62,26 +70,52 @@
|
|||||||
+ (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));
|
||||||
+ if (panel->active)
|
|
||||||
+ attrset (REVERSE_COLOR);
|
|
||||||
+ addstr (tmp);
|
+ addstr (tmp);
|
||||||
+ attrset (NORMAL_COLOR);
|
|
||||||
+ g_free (tmp);
|
+ g_free (tmp);
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
static void
|
static int
|
||||||
mini_info_separator (WPanel *panel)
|
quit_cmd_internal (int quiet)
|
||||||
{
|
{
|
||||||
@@ -866,6 +908,7 @@
|
--- mc-4.6.1a/src/main.h.showfree 2006-05-29 09:42:29.000000000 +0200
|
||||||
|
+++ mc-4.6.1a/src/main.h 2006-05-29 10:30:37.000000000 +0200
|
||||||
|
@@ -55,6 +55,7 @@
|
||||||
|
extern int show_all_if_ambiguous;
|
||||||
|
extern int slow_terminal;
|
||||||
|
extern int update_prompt; /* To comunicate with subshell */
|
||||||
|
+extern char *old_cwd;
|
||||||
|
extern int safe_delete;
|
||||||
|
extern int confirm_delete;
|
||||||
|
extern int confirm_directory_hotlist_delete;
|
||||||
|
@@ -102,6 +103,7 @@
|
||||||
|
int load_prompt (int, void *);
|
||||||
|
void save_cwds_stat (void);
|
||||||
|
void quiet_quit_cmd (void); /* For cmd.c and command.c */
|
||||||
|
+void show_free_space(WPanel *panel);
|
||||||
|
|
||||||
|
void touch_bar (void);
|
||||||
|
void update_xterm_title_path (void);
|
||||||
|
--- mc-4.6.1a/src/screen.c.showfree 2006-05-29 09:42:29.000000000 +0200
|
||||||
|
+++ mc-4.6.1a/src/screen.c 2006-05-29 10:14:55.000000000 +0200
|
||||||
|
@@ -47,7 +47,7 @@
|
||||||
|
#include "widget.h"
|
||||||
|
#include "menu.h" /* menubar_visible */
|
||||||
|
#define WANT_WIDGETS
|
||||||
|
-#include "main.h" /* the_menubar */
|
||||||
|
+#include "main.h" /* the_menubar, show_free_space() */
|
||||||
|
#include "unixcompat.h"
|
||||||
|
|
||||||
|
#define ELEMENTS(arr) ( sizeof(arr) / sizeof((arr)[0]) )
|
||||||
|
@@ -866,6 +866,7 @@
|
||||||
hline ((slow_terminal ? '-' : ACS_HLINE) | NORMAL_COLOR,
|
hline ((slow_terminal ? '-' : ACS_HLINE) | NORMAL_COLOR,
|
||||||
panel->widget.cols - 2);
|
panel->widget.cols - 2);
|
||||||
#endif /* !HAVE_SLANG */
|
#endif /* !HAVE_SLANG */
|
||||||
+ if (free_space) show_free_space (panel);
|
+ show_free_space (panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -929,6 +972,8 @@
|
@@ -929,6 +930,8 @@
|
||||||
widget_move (&panel->widget, 0, panel->widget.cols - 3);
|
widget_move (&panel->widget, 0, panel->widget.cols - 3);
|
||||||
addstr ("v");
|
addstr ("v");
|
||||||
|
|
||||||
@ -90,8 +124,8 @@
|
|||||||
if (panel->active)
|
if (panel->active)
|
||||||
standend ();
|
standend ();
|
||||||
}
|
}
|
||||||
--- mc-4.6.1a/src/layout.c.showfree 2006-05-17 13:16:46.000000000 +0200
|
--- mc-4.6.1a/src/layout.c.showfree 2006-05-29 09:42:28.000000000 +0200
|
||||||
+++ mc-4.6.1a/src/layout.c 2006-05-17 13:21:04.000000000 +0200
|
+++ mc-4.6.1a/src/layout.c 2006-05-29 09:42:29.000000000 +0200
|
||||||
@@ -99,6 +99,9 @@
|
@@ -99,6 +99,9 @@
|
||||||
/* Set to show current working dir in xterm window title */
|
/* Set to show current working dir in xterm window title */
|
||||||
int xterm_title = 1;
|
int xterm_title = 1;
|
||||||
@ -258,7 +292,7 @@
|
|||||||
add_widget (layout_dlg, radio_widget);
|
add_widget (layout_dlg, radio_widget);
|
||||||
radio_widget->sel = horizontal_split;
|
radio_widget->sel = horizontal_split;
|
||||||
--- mc-4.6.1a/src/layout.h.showfree 2004-12-03 20:17:47.000000000 +0100
|
--- mc-4.6.1a/src/layout.h.showfree 2004-12-03 20:17:47.000000000 +0100
|
||||||
+++ mc-4.6.1a/src/layout.h 2006-05-17 13:16:47.000000000 +0200
|
+++ mc-4.6.1a/src/layout.h 2006-05-29 09:42:29.000000000 +0200
|
||||||
@@ -39,6 +39,7 @@
|
@@ -39,6 +39,7 @@
|
||||||
extern int output_start_y;
|
extern int output_start_y;
|
||||||
extern int message_visible;
|
extern int message_visible;
|
||||||
|
6
mc.spec
6
mc.spec
@ -1,7 +1,7 @@
|
|||||||
Summary: User-friendly text console file manager and visual shell.
|
Summary: User-friendly text console file manager and visual shell.
|
||||||
Name: mc
|
Name: mc
|
||||||
Version: 4.6.1a
|
Version: 4.6.1a
|
||||||
Release: 15
|
Release: 16
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
License: GPL
|
License: GPL
|
||||||
Group: System Environment/Shells
|
Group: System Environment/Shells
|
||||||
@ -188,6 +188,10 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%dir %{_sysconfdir}/mc
|
%dir %{_sysconfdir}/mc
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon May 29 2006 Jindrich Novy <jnovy@redhat.com> 4.6.1a-16
|
||||||
|
- fix the free space widget patch: stat()s filesystem less
|
||||||
|
frequently, display correct info in all circumstances
|
||||||
|
|
||||||
* Wed May 17 2006 Jindrich Novy <jnovy@redhat.com> 4.6.1a-15
|
* Wed May 17 2006 Jindrich Novy <jnovy@redhat.com> 4.6.1a-15
|
||||||
- update from CVS
|
- update from CVS
|
||||||
- drop .fish-upload patch, applied upstream
|
- drop .fish-upload patch, applied upstream
|
||||||
|
Loading…
Reference in New Issue
Block a user