Re: Quoting of variables in fsusage.m4 and ls-mntd-fs.m4

2006-05-29 Thread Roland Illig

Roland Illig wrote:
The quoting hid one bug that appeared due to one variable being used, 
which had never been defined before. I think it has been fixed upstream.


It has, and I updated our version of ls-mntd-fs.m4 to the one of 
coreutils. I also documented that in the ChangeLog. Sorry that it took 
so long.


Roland
___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: Quoting of variables in fsusage.m4 and ls-mntd-fs.m4

2006-05-29 Thread Pavel Tsekov

On Mon, 29 May 2006, Roland Illig wrote:


Roland Illig wrote:
The quoting hid one bug that appeared due to one variable being used, which 
had never been defined before. I think it has been fixed upstream.


It has, and I updated our version of ls-mntd-fs.m4 to the one of coreutils. I 
also documented that in the ChangeLog. Sorry that it took so long.


What do you think about my suggestion to move your changes in configure.ac
to acinclude.m4 ?
___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: [RFE][PATCH] Display free space on device in panels

2006-05-29 Thread Jindrich Novy
Hi Pavel and Pavel,

On Fri, 2006-05-19 at 14:29 -0400, Pavel Roskin wrote:
 Can we avoid any highlighting?  I think Far Manager does it right:
 http://red-bean.com/proski/mc/far.png

Attaching the patch without highlighting. The main changes are that I
moved the show_free_space() into main.c since screen.c lacks a header
file and a call is needed from cmd.c to minimize frequency of gathering
filesys info. The free space widget isn't displayed at all when browsing
a non-local fs. Filesystem statistics are updated immediately when mc
requests a reread (ctrl-r is pressed).

Please review, some further mistakes are possible.

Cheers,
Jindrich
--- mc-4.6.1a/src/setup.c.showfree	2006-02-23 16:32:18.0 +0100
+++ mc-4.6.1a/src/setup.c	2006-05-29 09:42:29.0 +0200
@@ -134,6 +134,7 @@
 { show_mini_info, show_mini_info },
 { permission_mode, permission_mode },
 { filetype_mode, filetype_mode },
+{ free_space, free_space },
 { 0, 0 }
 };
 
--- mc-4.6.1a/src/main.c.showfree	2006-05-29 12:41:36.0 +0200
+++ mc-4.6.1a/src/main.c	2006-05-29 13:04:50.0 +0200
@@ -61,6 +61,7 @@
 #include listmode.h
 #include execute.h
 #include ext.h		/* For flush_extension_file() */
+#include mountlist.h		/* my_statfs */
 
 /* Listbox for the command history feature */
 #include widget.h
@@ -231,6 +232,12 @@
 /* We need to paint it after CONSOLE_RESTORE, see: load_prompt */
 int update_prompt = 0;
 
+/* Old current working directory for displaying free space */
+char *old_cwd = NULL;
+
+/* Used to figure out how many free space we have */
+struct my_statfs myfs_stats;
+
 /* The home directory */
 const char *home_dir = NULL;
 
@@ -402,6 +409,8 @@
 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
+show_free_space(WPanel *panel)
+{
+struct stat st;
+
+/* Don't try to stat non-local fs */
+if (!vfs_file_is_local(panel-cwd) || !free_space)
+	return;
+   
+if (old_cwd == NULL || strcmp(old_cwd, panel-cwd) != 0) {
+	init_my_statfs();
+	g_free(old_cwd);
+	old_cwd = g_strdup(panel-cwd);
+	my_statfs (myfs_stats, panel-cwd);
+}
+   
+st = panel-dir.list [panel-selected].st;
+   
+if (myfs_stats.avail  0 || myfs_stats.total  0) {
+	char buffer1 [6], buffer2[6], *tmp;
+	size_trunc_len (buffer1, 5, myfs_stats.avail, 1);
+	size_trunc_len (buffer2, 5, myfs_stats.total, 1);
+	tmp = g_strdup_printf (_(%s (%d%%) of %s), buffer1, myfs_stats.total  0 ?
+			   (int)(100 * (double)myfs_stats.avail / myfs_stats.total) : 0,
+			   buffer2);
+	widget_move (panel-widget, panel-widget.lines-3, panel-widget.cols-2-strlen(tmp));
+	addstr (tmp);
+	g_free (tmp);
+}
+}
+ 
 static int
 quit_cmd_internal (int quiet)
 {
--- mc-4.6.1a/src/main.h.showfree	2006-05-29 09:42:29.0 +0200
+++ mc-4.6.1a/src/main.h	2006-05-29 10:30:37.0 +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.0 +0200
+++ mc-4.6.1a/src/screen.c	2006-05-29 10:14:55.0 +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,
 	   panel-widget.cols - 2);
 #endif/* !HAVE_SLANG */
+show_free_space (panel);
 }
 
 static void
@@ -929,6 +930,8 @@
 widget_move (panel-widget, 0, panel-widget.cols - 3);
 addstr (v);
 
+mini_info_separator (panel);
+
 if (panel-active)
 	standend ();
 }
--- mc-4.6.1a/src/layout.c.showfree	2006-05-29 09:42:28.0 +0200
+++ mc-4.6.1a/src/layout.c	2006-05-29 09:42:29.0 +0200
@@ -99,6 +99,9 @@
 /* Set to show current working dir in xterm window title */
 int xterm_title = 1;
 
+/* Set to show free space on device assigned to current directory */
+int free_space = 1;
+
 /* The starting line for the output of the subprogram */
 int