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

2006-05-31 Thread Pavel Tsekov

On Wed, 31 May 2006, Oswald Buddenhagen wrote:


On Wed, May 31, 2006 at 05:13:29PM +0300, Pavel Tsekov wrote:

There is no need to profile MC. It is not speedup in terms of CPU
cycles but in reduced screen update i.e. why paint the frame each time
if it really doesn't change at all.


it should be pointed out that the screen libs (ncurses and slang)
optimize away redundant paints (this can be best proved by messing up
the screen (e.g., with write) and doing something that _certainly_ does
a full paint - like opening the editor).
so the redundant painting happens only in the screen lib's frame buffer,
which isn't that expensive, really. so if it's only one line and the
optimization would be pretty complicated, it simply would not pay. but i
can't judge that case, as i didn't read the code.


It's there and has been for some time. The new free space patch is 
simply not doing the right thing with respect to the existing code.

Whether this optimization is worth or not is something that should
be discussed in another thread. But if anyone feels that the new
patch should go in as is lets put it for a vote. It is really not
my intention to stop that patch from being checked in.

As for the smart screen libraries - yes they do try to reduce the
number of real screen updates. But this suggestion that I made to
Jindrich i.e. to trace with gdb:

  http://mail.gnome.org/archives/mc-devel/2006-May/msg00119.html

It shows that S-Lang is not doing the smartest thing. There are many
other examples when data is printed to the screen right away.


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


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

2006-05-31 Thread Oswald Buddenhagen
On Wed, May 31, 2006 at 05:13:29PM +0300, Pavel Tsekov wrote:
> There is no need to profile MC. It is not speedup in terms of CPU
> cycles but in reduced screen update i.e. why paint the frame each time
> if it really doesn't change at all.
> 
it should be pointed out that the screen libs (ncurses and slang)
optimize away redundant paints (this can be best proved by messing up
the screen (e.g., with write) and doing something that _certainly_ does
a full paint - like opening the editor).
so the redundant painting happens only in the screen lib's frame buffer,
which isn't that expensive, really. so if it's only one line and the
optimization would be pretty complicated, it simply would not pay. but i
can't judge that case, as i didn't read the code.

-- 
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
--
Chaos, panic, and disorder - my work here is done.
___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


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

2006-05-31 Thread Pavel Tsekov

On Wed, 31 May 2006, Jindrich Novy wrote:


On Tue, 2006-05-30 at 14:56 +0300, Pavel Tsekov wrote:

On Mon, 29 May 2006, Jindrich Novy wrote:


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.


Now, after I reviewed the patch for a second time I am pretty convinced
that the free space info should be displayed in the mini status area
and not on its upper frame i.e. as it is in FAR manager (what Pavel
Rosking suggested).


Yes, otherwise it would be too little space for cwd, especially for
80x25 terminals.


Well, maybe I didn't explain well - I mean't the horizontal line between
the mini status and the directory listing.


MC tries to optimize the screen drawing by updating only certain parts
of the screen (the directory contents, the mini status) when not otherwise
necessary. Simply put MC doesn't update the whole screen when you go down
one file in the panel, when you change a directory, etc. With the current
patch you actually break that optimization by inserting a call to
mini_info_separator() in show_dir() which is called each time you move
through the file list for example.


Ok, the only speed related optimization I see is to not to draw the free
space widget every time the show_free_space() is called, but only in
case when old_cwd and panel_cwd differs. The trick to force redraw when
user presses ctrl-r by setting old_cwd to NULL will work then anyway.


Maybe this wasn't clear as well  - I'll try by pointing you directly to 
the code. See the difference between paint_panel ()  and 
panel_update_contents().



Your patch may be modified to so that it will work properly i.e. it wont
break the optimization but it becomes ugly (codewise). It may be modified
to be not so ugly by sacrificing the optimization a bit i.e. put
a call to mini_info_separator () in panel_update_contents(). It also
can be made to fit into the current scheme by making the free space info
part of the mini status area.


Did you do some profiling that it slows mc down significantly? I haven't
seen a noticable delay, especially after show_free_space() doesn't draw
the widget each time it's called.


There is no need to profile MC. It is not speedup in terms of CPU cycles
but in reduced screen update i.e. why paint the frame each time if it
really doesn't change at all.


Now, there are some other small issues with the patch as-is:

--- mc-4.6.1a/src/main.c.showfree   2006-05-29 12:41:36.0 +0200
+++ mc-4.6.1a/src/main.c2006-05-29 13:04:50.0 +0200
@@ -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);

This part is not necessary. And it will draw the free_space_info() even
if there is no mini status (though you won't see it).


show_free_space() checks whether free_space != 0 otherwise it won't draw
anything.


Yes. But it will draw when the mini status is disabled. If you 
are not convinced - you could try stepping trough the body of 
update_panels() with a debugger. This slows the execution time and

it will allow you to see the free space info being printed.

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


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

2006-05-31 Thread Leonard den Ottolander
Hello Jindrich,

On Wed, 2006-05-31 at 15:56 +0200, Jindrich Novy wrote:
> On Tue, 2006-05-30 at 14:56 +0300, Pavel Tsekov wrote: 
> > Now, after I reviewed the patch for a second time I am pretty convinced 
> > that the free space info should be displayed in the mini status area
> > and not on its upper frame i.e. as it is in FAR manager (what Pavel 
> > Rosking suggested). 
> 
> Yes, otherwise it would be too little space for cwd, especially for
> 80x25 terminals.

How about making it an option *in* the mini status panel and setting it
via the listing mode dialog?

Leonard.

-- 
mount -t life -o ro /dev/dna /genetic/research


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


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

2006-05-31 Thread Jindrich Novy
Hi Pavel,

On Tue, 2006-05-30 at 14:56 +0300, Pavel Tsekov wrote: 
> On Mon, 29 May 2006, Jindrich Novy wrote:
> 
> > 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.
> 
> Now, after I reviewed the patch for a second time I am pretty convinced 
> that the free space info should be displayed in the mini status area
> and not on its upper frame i.e. as it is in FAR manager (what Pavel 
> Rosking suggested). 

Yes, otherwise it would be too little space for cwd, especially for
80x25 terminals.

> MC tries to optimize the screen drawing by updating only certain parts
> of the screen (the directory contents, the mini status) when not otherwise 
> necessary. Simply put MC doesn't update the whole screen when you go down 
> one file in the panel, when you change a directory, etc. With the current 
> patch you actually break that optimization by inserting a call to
> mini_info_separator() in show_dir() which is called each time you move
> through the file list for example.

Ok, the only speed related optimization I see is to not to draw the free
space widget every time the show_free_space() is called, but only in
case when old_cwd and panel_cwd differs. The trick to force redraw when
user presses ctrl-r by setting old_cwd to NULL will work then anyway.

> Your patch may be modified to so that it will work properly i.e. it wont
> break the optimization but it becomes ugly (codewise). It may be modified
> to be not so ugly by sacrificing the optimization a bit i.e. put
> a call to mini_info_separator () in panel_update_contents(). It also
> can be made to fit into the current scheme by making the free space info
> part of the mini status area.

Did you do some profiling that it slows mc down significantly? I haven't
seen a noticable delay, especially after show_free_space() doesn't draw
the widget each time it's called.

> Now, there are some other small issues with the patch as-is:
> 
> --- 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
> @@ -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);
> 
> This part is not necessary. And it will draw the free_space_info() even
> if there is no mini status (though you won't see it).

show_free_space() checks whether free_space != 0 otherwise it won't draw
anything.

> @@ -467,6 +476,37 @@
>   }
>   }
> 
> +void
> +show_free_space(WPanel *panel)
> +{
> +struct stat st;
> 
> This is not necessary as well as the code which fills it.

Yes, I'll remove it.

Jindrich

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


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

2006-05-30 Thread Pavel Tsekov

On Mon, 29 May 2006, Jindrich Novy wrote:


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.


Now, after I reviewed the patch for a second time I am pretty convinced 
that the free space info should be displayed in the mini status area
and not on its upper frame i.e. as it is in FAR manager (what Pavel 
Rosking suggested). Here is why:


MC tries to optimize the screen drawing by updating only certain parts
of the screen (the directory contents, the mini status) when not otherwise 
necessary. Simply put MC doesn't update the whole screen when you go down 
one file in the panel, when you change a directory, etc. With the current 
patch you actually break that optimization by inserting a call to

mini_info_separator() in show_dir() which is called each time you move
through the file list for example.

Your patch may be modified to so that it will work properly i.e. it wont
break the optimization but it becomes ugly (codewise). It may be modified
to be not so ugly by sacrificing the optimization a bit i.e. put
a call to mini_info_separator () in panel_update_contents(). It also
can be made to fit into the current scheme by making the free space info
part of the mini status area.

Now, there are some other small issues with the patch as-is:

--- mc-4.6.1a/src/main.c.showfree   2006-05-29 12:41:36.0 +0200
+++ mc-4.6.1a/src/main.c2006-05-29 13:04:50.0 +0200
@@ -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);

This part is not necessary. And it will draw the free_space_info() even
if there is no mini status (though you won't see it).

@@ -467,6 +476,37 @@
 }
 }

+void
+show_free_space(WPanel *panel)
+{
+struct stat st;

This is not necessary as well as the code which fills it.


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


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

2006-05-30 Thread Jindrich Novy
On Tue, 2006-05-30 at 11:36 +0300, Pavel Tsekov wrote:
> Please, do not send patches generated against UTF8-ized version of MC.

Ah, done that again. Attaching the cleanly applicable variant then.

Jindrich

-- 
Jindrich Novy <[EMAIL PROTECTED]>
--- mc/src/screen.c.orig	2006-02-08 11:10:37.0 +0100
+++ mc/src/screen.c	2006-05-30 13:09:46.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]) )
@@ -761,6 +761,7 @@
 hline ((slow_terminal ? '-' : ACS_HLINE) | NORMAL_COLOR,
 	   panel->widget.cols - 2);
 #endif/* !HAVE_SLANG */
+show_free_space (panel);
 }
 
 static void
@@ -802,6 +803,8 @@
 widget_move (&panel->widget, 0, panel->widget.cols - 3);
 addstr ("v");
 
+mini_info_separator (panel);
+
 if (panel->active)
 	standend ();
 }
--- mc/src/main.c.orig	2006-05-30 13:09:46.0 +0200
+++ mc/src/main.c	2006-05-30 13:09:46.0 +0200
@@ -60,6 +60,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"
@@ -230,6 +231,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;
 
@@ -395,6 +402,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);
@@ -460,6 +469,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/src/setup.c.orig	2006-02-23 16:32:18.0 +0100
+++ mc/src/setup.c	2006-05-30 13:30:43.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/src/main.h.orig	2006-02-03 18:07:39.0 +0100
+++ mc/src/main.h	2006-05-30 13:09:46.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;
@@ -100,6 +101,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/src/layout.c.orig	2006-02-28 17:15:21.0 +0100
+++ mc/src/layout.c	2006-05-30 13:10:03.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 output_start_y = 0;
 
@@ -128,6 +131,7 @@
 static int _keybar_visible;
 static int _message_visible;
 static int _xterm_title;
+static int _free_space;
 static int _permission_mode;
 static int _filetype_mode;
 
@@ -158,6 +162,7 @@
 int*variable;
 WCheck *widget;
 } check_options [] = {
+{ N_("show free sp&Ace"),  &free_space,  0 },
 { N_("&Xterm window title"), &xterm_title,   0 },
 { N_("h&Intbar visible

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

2006-05-30 Thread Pavel Tsekov

On Mon, 29 May 2006, Jindrich Novy wrote:


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.


Please, do not send patches generated against UTF8-ized version of MC. I 
think I mentiond it already .

___
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;
+
 /* Th

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

2006-05-24 Thread Leonard den Ottolander
Hi,

On Fri, 2006-05-19 at 21:08 +0200, Oswald Buddenhagen wrote:
> yes, but i definitely prefer the totals above the mini-status. i think
> that's what they had in earlier times, too.

Maybe the free space could be an option *in* the mini status. To make
people aware of this new option we could default to representing it in
the mini status.

Using this option to the mini status probably means the mini status
needs to be updated on occasions. Jindrich, are you willing to rewrite
your patch in this way?

A small point of criticism is the size of the displayed string.
Something like

888/999M 89%
999k/100M 1%

would be more to my liking. This way the string is as long as a date
field (except when the disk is filled for 100%, and assuming >= 1000k is
translated to 1M etc).

Leonard.

-- 
mount -t life -o ro /dev/dna /genetic/research


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


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

2006-05-19 Thread Oswald Buddenhagen
On Fri, May 19, 2006 at 02:29:49PM -0400, Pavel Roskin wrote:
> Hello!
> 
> > I was originally inspired by the old czech m602 file manager:
> > http://oldgame.legalne.net/big/images/Manazer-M602.00.120.jpg
> > 
> > A bit more talky design was used in the DOS Navigator:
> > http://www.dev0.de/pix/dn151lfnbeta3.png
> 
> Can we avoid any highlighting?  I think Far Manager does it right:
> http://red-bean.com/proski/mc/far.png
> 
yes, but i definitely prefer the totals above the mini-status. i think
that's what they had in earlier times, too.

-- 
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
--
Chaos, panic, and disorder - my work here is done.
___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


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

2006-05-19 Thread Pavel Roskin
Hello!

> I was originally inspired by the old czech m602 file manager:
> http://oldgame.legalne.net/big/images/Manazer-M602.00.120.jpg
> 
> A bit more talky design was used in the DOS Navigator:
> http://www.dev0.de/pix/dn151lfnbeta3.png

Can we avoid any highlighting?  I think Far Manager does it right:
http://red-bean.com/proski/mc/far.png

-- 
Regards,
Pavel Roskin

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


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

2006-05-19 Thread Leonard den Ottolander
Hi Jindrich,

On Fri, 2006-05-19 at 17:16 +0200, Jindrich Novy wrote:
> > >   When it wouldn't be highlighted, you need
> > >   to look up at the panel title to be sure whether it's active since
> > >   the the highlighted widgets are on top of the panel. This may save
> > >   you one eye movement ;)

I don't need any eye movement to see which panel is highlighted. Not
much of an argument IMO ;p .

> I decided to put it
> down for mc to have more space for the directory name since the bottom
> frame of the panel is unused. It could be moved upwards though if more
> people like it.

At the top it would only take away space for the file name. The
positioning is fine with me, it's just the (extra) highlighting that I
find distracting. But opinions on this matter differ :) .

Leonard.

-- 
mount -t life -o ro /dev/dna /genetic/research


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


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

2006-05-19 Thread Jindrich Novy
Hi Pavel,

On Fri, 2006-05-19 at 16:07 +0300, Pavel Tsekov wrote:
> > 2) You are sure that you are looking at the correct free space in the
> >   panel you are working in. When it wouldn't be highlighted, you need
> >   to look up at the panel title to be sure whether it's active since
> >   the the highlighted widgets are on top of the panel. This may save
> >   you one eye movement ;)
> 
> How about moving the free space indicator to same line on which the panel
> title is displayed ? How is it implemented in other file managers ?

I was originally inspired by the old czech m602 file manager:
http://oldgame.legalne.net/big/images/Manazer-M602.00.120.jpg

A bit more talky design was used in the DOS Navigator:
http://www.dev0.de/pix/dn151lfnbeta3.png

You can see the free space widget is on top in m602. I decided to put it
down for mc to have more space for the directory name since the bottom
frame of the panel is unused. It could be moved upwards though if more
people like it.

Cheers,
Jindrich

-- 
Jindrich Novy <[EMAIL PROTECTED]>

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


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

2006-05-19 Thread Pavel Tsekov

On Fri, 19 May 2006, Jindrich Novy wrote:


On Thu, 2006-05-18 at 23:42 +0200, Leonard den Ottolander wrote:

On Thu, 2006-05-18 at 16:36 +0300, Pavel Tsekov wrote:

Btw if anyone on this list wants to share his thoughts on this patch - now
is the time.


Personally I don't like the highlighting of the free space indicator. I
find it rather distracting. It suffices that the top of the panel is
highlighted, no need to highlight that info for the active panel. IMO
the conditional attrset (REVERSE_COLOR) etc should be removed.


I noticed your reply related to the free space widget highlighting also
on bugzilla. I my opinion it makes the look-and-feel of mc more
consistent when the free space widget is highlighted. The reasons are:

1) Everything what is written directly to the panel frame is highlighted
  (current working directory, directory history widget).


I second that.



2) You are sure that you are looking at the correct free space in the
  panel you are working in. When it wouldn't be highlighted, you need
  to look up at the panel title to be sure whether it's active since
  the the highlighted widgets are on top of the panel. This may save
  you one eye movement ;)


How about moving the free space indicator to same line on which the panel
title is displayed ? How is it implemented in other file managers ?
___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


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

2006-05-19 Thread Jindrich Novy
Hi Leonard,

On Thu, 2006-05-18 at 23:42 +0200, Leonard den Ottolander wrote:
> On Thu, 2006-05-18 at 16:36 +0300, Pavel Tsekov wrote:
> > Btw if anyone on this list wants to share his thoughts on this patch - now 
> > is the time.
> 
> Personally I don't like the highlighting of the free space indicator. I
> find it rather distracting. It suffices that the top of the panel is
> highlighted, no need to highlight that info for the active panel. IMO
> the conditional attrset (REVERSE_COLOR) etc should be removed.

I noticed your reply related to the free space widget highlighting also
on bugzilla. I my opinion it makes the look-and-feel of mc more
consistent when the free space widget is highlighted. The reasons are:

1) Everything what is written directly to the panel frame is highlighted
   (current working directory, directory history widget).

2) You are sure that you are looking at the correct free space in the
   panel you are working in. When it wouldn't be highlighted, you need
   to look up at the panel title to be sure whether it's active since
   the the highlighted widgets are on top of the panel. This may save
   you one eye movement ;)

It seems that we need a feedback from someone else whether to highlight
or not. If more users are unhappy with the highlighting, I have no
problem with removing it. The current version of the patch is applied in
FC5 if you want to see how it looks like (highlighted version).

Cheers,
Jindrich

-- 
Jindrich Novy <[EMAIL PROTECTED]>

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


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

2006-05-18 Thread Leonard den Ottolander
Hi Pavel,

On Thu, 2006-05-18 at 16:36 +0300, Pavel Tsekov wrote:
> Btw if anyone on this list wants to share his thoughts on this patch - now 
> is the time.

Personally I don't like the highlighting of the free space indicator. I
find it rather distracting. It suffices that the top of the panel is
highlighted, no need to highlight that info for the active panel. IMO
the conditional attrset (REVERSE_COLOR) etc should be removed.

Leonard.

-- 
mount -t life -o ro /dev/dna /genetic/research


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


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

2006-05-18 Thread Jindrich Novy
Hi Pavel,

On Thu, 2006-05-18 at 16:36 +0300, Pavel Tsekov wrote:
> On Thu, 18 May 2006, Jindrich Novy wrote:
> 
> > Yes, the patch can still be improved. I posted it here just to discuss
> > the feature and whether upstream likes it. It's still not a commit
> > candidate yet.
> 
> Well, it seems that this is a much desired feature... I've seen people
> requesting it at several different places. Despite from the strcmp()
> issue do you plan to improve it one way or another anytime soon. I mean
> should I wait for an update or just commit it as is ?

Ok, I'll send a better patch in a few days. So please wait with
committing for a while.

Cheers,
Jindrich

-- 
Jindrich Novy <[EMAIL PROTECTED]>

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


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

2006-05-18 Thread Pavel Tsekov

On Thu, 18 May 2006, Jindrich Novy wrote:


Yes, the patch can still be improved. I posted it here just to discuss
the feature and whether upstream likes it. It's still not a commit
candidate yet.


Well, it seems that this is a much desired feature... I've seen people
requesting it at several different places. Despite from the strcmp()
issue do you plan to improve it one way or another anytime soon. I mean
should I wait for an update or just commit it as is ?

Btw if anyone on this list wants to share his thoughts on this patch - now 
is the time.


Pavel "The Prick" Tsekov


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


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

2006-05-18 Thread Jindrich Novy
Hi Pavel,

On Thu, 2006-05-18 at 12:11 +0300, Pavel Tsekov wrote:
> Hello Jindrich,
> 
> On Wed, 1 Feb 2006, Jindrich Novy wrote:
> 
> > On Mon, 2006-01-02 at 14:41 +0100, Jindrich Novy wrote:
> >> thanks for your comments, attaching the patch better matching the mc
> >> coding style.
> >
> > I modified the patch so that it can be switched on/off in the
> > Options/Layout dialog to display free space on device.
> 
> I red the patch more carefully and I have several questions:
> 
> 1)
> 
> --- mc-4.6.1a/src/screen.c.showfree   2006-01-31 21:59:12.0 +0100
> +++ mc-4.6.1a/src/screen.c2006-01-31 21:59:12.0 +0100
> @@ -49,6 +49,7 @@
> +static void
> +show_free_space(WPanel *panel)
> +{
> +struct stat st;
> +
> +/* Don't try to stat non-local fs */
> +if (!vfs_file_is_local(panel->cwd))
> + return;
> +
> +if (old_cwd == NULL || strcmp(old_cwd, panel->cwd) == 0) {
>  ^^^
> 
> Is this made on purpose ? Maybe you meant '!=' ?

Thanks for the review. There should be != of course as we need to update
old_cwd whenever it differs from panel->cwd.


> 2) Do you think that retrieving the free space information once per
> directory read would diminish the effect of this patch. Currently
> my_statfs () is called each time the screen changes i.e. move up,
> move down, etc - this seems a bit too much ...

Yes, the patch can still be improved. I posted it here just to discuss
the feature and whether upstream likes it. It's still not a commit
candidate yet.

> Pavel "The Prick" Tsekov

LOL, feel free to be Mr. Prick here ;)

Jindrich

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


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

2006-05-18 Thread Pavel Tsekov

On Wed, 1 Feb 2006, Jindrich Novy wrote:


Hello,

On Mon, 2006-01-02 at 14:41 +0100, Jindrich Novy wrote:

thanks for your comments, attaching the patch better matching the mc
coding style.


I modified the patch so that it can be switched on/off in the
Options/Layout dialog to display free space on device.


P.S. I forgot to mention that your patch doesn't apply cleanly since it 
was generated against UTF8-ized MC (IMO).

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


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

2006-05-18 Thread Pavel Tsekov

Hello Jindrich,

On Wed, 1 Feb 2006, Jindrich Novy wrote:


On Mon, 2006-01-02 at 14:41 +0100, Jindrich Novy wrote:

thanks for your comments, attaching the patch better matching the mc
coding style.


I modified the patch so that it can be switched on/off in the
Options/Layout dialog to display free space on device.


I red the patch more carefully and I have several questions:

1)

--- mc-4.6.1a/src/screen.c.showfree 2006-01-31 21:59:12.0 +0100
+++ mc-4.6.1a/src/screen.c  2006-01-31 21:59:12.0 +0100
@@ -49,6 +49,7 @@
+static void
+show_free_space(WPanel *panel)
+{
+struct stat st;
+
+/* Don't try to stat non-local fs */
+if (!vfs_file_is_local(panel->cwd))
+   return;
+
+if (old_cwd == NULL || strcmp(old_cwd, panel->cwd) == 0) {
^^^

Is this made on purpose ? Maybe you meant '!=' ?

2) Do you think that retrieving the free space information once per
directory read would diminish the effect of this patch. Currently
my_statfs () is called each time the screen changes i.e. move up,
move down, etc - this seems a bit too much ...

Pavel "The Prick" Tsekov

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


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

2006-02-01 Thread Jindrich Novy
Hello,

On Mon, 2006-01-02 at 14:41 +0100, Jindrich Novy wrote:
> thanks for your comments, attaching the patch better matching the mc
> coding style.

I modified the patch so that it can be switched on/off in the
Options/Layout dialog to display free space on device.

termshot(TM) is attached:
┌<─~──v>┐┌<─~/CVS/mc/devel──v>┐
│   Name   │Size│  MTime││   Name   │Size │  MTime│
│/..   │UP--│   ▲│/..   │UP--D│   ▲
│/.Azureus │4096│Dec 29 15: ●│/CVS  │ 4096│Jan 25 13: ●
│/.TeXmacs │4096│Oct  6 10: ▒│/i386 │ 4096│Feb  1 07: ▒
│/.Trash   │4096│Jan  8 22: ▒│/mc-4.6.1a│ 4096│Feb  1 07: ▒
│/.aMule   │4096│Nov 26 21: ▒│ .cvs~nore│   18│Dec  6 13: ▒
│/.amaya   │4096│Jan 10 14: ▒│ Makefile │  175│Sep  9  20 ▒
│/.anjuta  │4096│Dec 30 15: ▒│ mc-2~atch│  501│Jan 31 12: ▒
│/.cam~erts│4096│Aug 20 21: ▒│ mc-4~.rpm│2950K│Jan 25 16: ▒
│/.cdd~lave│4096│Jan  1 01: ▒│ mc-4~.rpm│2951K│Feb  1 07: ▒
│/.comments│4096│Jan 15 21: ▒│ mc-4~.bz2│2862K│Nov 29 22: ▒
│/.ddd │4096│Jan 28 14: ▒│ mc-4~.new│2863K│Jan 29 19: ▒
├2787M (12%) of 21G─▼├─2787M (12%) of 21G─▼
│/..   │UP--│drwxr-xr-x ││/..   │UP--D│drwxr-xr-x │
└───┘└┘
enigma:~/CVS/mc/devel$  [^]

what shows how the free space on device is displayed.

ChangeLog:
2006-02-01  Jindrich Novy  <[EMAIL PROTECTED]>

* screen.c: Add new function show_free_space() to display free
space on device. Add calls so that show_free_space() is called
when panels are drawn.
* layout.c (struct check_options, b2left_cback, b2right_cback
layout_callback, init_layout): Add configuration option to
Options/Layout dialog.

Regards,
Jindrich
-- 
Jindrich Novy <[EMAIL PROTECTED]>, http://people.redhat.com/jnovy/
(o_   _o)
//\  The worst evil in the world is refusal to think. //\
V_/_ _\_V

--- mc-4.6.1a/src/screen.c.showfree	2006-01-31 21:59:12.0 +0100
+++ mc-4.6.1a/src/screen.c	2006-01-31 21:59:12.0 +0100
@@ -49,6 +49,7 @@
 #define WANT_WIDGETS
 #include "main.h"		/* the_menubar */
 #include "unixcompat.h"
+#include "mountlist.h"		/* my_statfs */
 
 #define ELEMENTS(arr) ( sizeof(arr) / sizeof((arr)[0]) )
 
@@ -106,6 +107,12 @@ int filetype_mode = 1;
 /* The hook list for the select file function */
 Hook *select_file_hook = 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;
+
 static cb_ret_t panel_callback (Widget *, widget_msg_t msg, int parm);
 static int panel_event (Gpm_Event *event, void *);
 static void paint_frame (WPanel *panel);
@@ -851,6 +858,41 @@ paint_dir (WPanel *panel)
 standend ();
 }
 
+
+static void
+show_free_space(WPanel *panel)
+{
+struct stat st;
+
+/* Don't try to stat non-local fs */
+if (!vfs_file_is_local(panel->cwd))
+	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));
+	if (panel->active)
+	attrset (REVERSE_COLOR);
+	addstr (tmp);
+	attrset (NORMAL_COLOR);
+	g_free (tmp);
+}
+}
+
 static void
 mini_info_separator (WPanel *panel)
 {
@@ -866,6 +908,7 @@ mini_info_separator (WPanel *panel)
 hline ((slow_terminal ? '-' : ACS_HLINE) | NORMAL_COLOR,
 	   panel->widget.cols - 2);
 #endif/* !HAVE_SLANG */
+if (free_space) show_free_space (panel);
 }
 
 static void
@@ -929,6 +972,8 @@ show_dir (WPanel *panel)
 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-01-31 21:59:12.0 +0100
+++ mc-4.6.1a/src/layout.c	2006-01-31 22:02:28.0 +0100
@@ -99,6 +99,9 @@ int message_visible = 1;
 /* 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 output_start_y = 0;
 
@@ -128,6 +131,7 @@ static int _command_prompt;
 static int _keybar_visible;
 static int _message_visible;
 static int _xterm_title

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

2006-01-02 Thread Jindrich Novy
Hello Roland,

thanks for your comments, attaching the patch better matching the mc
coding style.

Jindrich
-- 
Jindrich Novy <[EMAIL PROTECTED]>, http://people.redhat.com/jnovy/
(o_   _o)
//\  The worst evil in the world is refusal to think. //\
V_/_ _\_V


--- mc-4.6.1a/src/screen.c.showfree	2006-01-02 12:22:51.0 +0100
+++ mc-4.6.1a/src/screen.c	2006-01-02 13:44:05.0 +0100
@@ -49,6 +49,7 @@
 #define WANT_WIDGETS
 #include "main.h"		/* the_menubar */
 #include "unixcompat.h"
+#include "mountlist.h"		/* my_statfs */
 
 #define ELEMENTS(arr) ( sizeof(arr) / sizeof((arr)[0]) )
 
@@ -106,6 +107,12 @@ int filetype_mode = 1;
 /* The hook list for the select file function */
 Hook *select_file_hook = 0;
 
+/* Old current working directory for displaying free space */
+static char *old_cwd = NULL;
+
+/* Used to figure out how many free space we have */
+static struct my_statfs myfs_stats;
+
 static cb_ret_t panel_callback (Widget *, widget_msg_t msg, int parm);
 static int panel_event (Gpm_Event *event, void *);
 static void paint_frame (WPanel *panel);
@@ -851,6 +858,41 @@ paint_dir (WPanel *panel)
 standend ();
 }
 
+
+static void
+show_free_space(WPanel *panel)
+{
+struct stat st;
+
+/* Don't try to stat non-local fs */
+if (!vfs_file_is_local(panel->cwd))
+	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));
+	if (panel->active)
+	attrset (REVERSE_COLOR);
+	addstr (tmp);
+	attrset (NORMAL_COLOR);
+	g_free (tmp);
+}
+}
+
 static void
 mini_info_separator (WPanel *panel)
 {
@@ -866,6 +908,7 @@ mini_info_separator (WPanel *panel)
 hline ((slow_terminal ? '-' : ACS_HLINE) | NORMAL_COLOR,
 	   panel->widget.cols - 2);
 #endif/* !HAVE_SLANG */
+show_free_space (panel);
 }
 
 static void
@@ -929,6 +972,8 @@ show_dir (WPanel *panel)
 widget_move (&panel->widget, 0, panel->widget.cols - 3);
 addstr ("v");
 
+mini_info_separator (panel);
+
 if (panel->active)
 	standend ();
 }
___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


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

2005-12-31 Thread Roland Illig
Jindrich Novy wrote:
> --- mc-4.6.1a/src/screen.c.showfree   2005-12-28 16:49:52.0 +0100
> +++ mc-4.6.1a/src/screen.c2005-12-28 17:14:45.0 +0100
> @@ -106,6 +107,12 @@ int filetype_mode = 1;
>  /* The hook list for the select file function */
>  Hook *select_file_hook = 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;
> +

As these variables are not mentioned in any header file, they should be
"static".

>  static cb_ret_t panel_callback (Widget *, widget_msg_t msg, int parm);
>  static int panel_event (Gpm_Event *event, void *);
>  static void paint_frame (WPanel *panel);
> @@ -851,6 +858,41 @@ paint_dir (WPanel *panel)
>  standend ();
>  }
>  
> +
> +static void
> +show_free_space(WPanel *panel)
> +{
> +struct stat st;
> +
> +/* Don't try to stat non-local fs */
> +if (strlen(panel->cwd) >= 2 && panel->cwd[0] == '/' && panel->cwd[1] == 
> '#')
> + return;

We have vfs_current_is_local() and vfs_file_is_local(), which should be
used instead of this hack.

> +if (old_cwd == NULL || strcmp(old_cwd, panel->cwd)) {

Please always compare the result of strcmp() to an integer, in this case 0.

> + init_my_statfs();
> + if (old_cwd != NULL) g_free(old_cwd);

The if (...) is unnecessary.

> + 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 ?

Please compare myfs_stats.total to 0 instead of treating it like a
boolean variable.

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