Re: mc Digest, Vol 116, Issue 6

2013-12-20 Thread chris glur
continual user requested changes can lead to disaster
Designed by a committee ?!


On 12/19/13, mc-requ...@gnome.org mc-requ...@gnome.org wrote:
 Send mc mailing list submissions to
   mc@gnome.org

 To subscribe or unsubscribe via the World Wide Web, visit
   https://mail.gnome.org/mailman/listinfo/mc
 or, via email, send a message with subject or body 'help' to
   mc-requ...@gnome.org

 You can reach the person managing the list at
   mc-ow...@gnome.org

 When replying, please edit your Subject line so it is more specific
 than Re: Contents of mc digest...


 Today's Topics:

1. disk usage status in right bottom corner (Konrad Vrba)
2. Re: mc Digest, Vol 116, Issue 5 (Mike Smithson)


 --

 Message: 1
 Date: Thu, 19 Dec 2013 00:02:38 +0100
 From: Konrad Vrba konrad.v...@gmail.com
 To: mc@gnome.org
 Subject: disk usage status in right bottom corner
 Message-ID:
   CAF2Nc0zH_Ew_tbEm44ZS9mJiUiqL0A=iyev1maj6krttyqu...@mail.gmail.com
 Content-Type: text/plain; charset=iso-8859-1

 hello,

 I would like to ask whether it is possible to change the disk status/usage
 information, which is displayed in the botom right corner in midnight
 commander (sorry if I am not using the correct terminology).

 The information displayed in my MC is free/total free%

 I would prefer to have % of used space, rather than % of free space. It
 might seem trivial, but I canot get used to the idea and it still confuses
 me. It seems to me logical to see what *is*on my disk, rather than what *is
 not*.

 Is there some way to adjust this, so that I can for example see just the
 %usage ?

 thanks,
 Konrad
 -- next part --
 An HTML attachment was scrubbed...
 URL:
 https://mail.gnome.org/archives/mc/attachments/20131219/95c05cbe/attachment.html

 --

 Message: 2
 Date: Wed, 18 Dec 2013 17:48:14 -0800
 From: Mike Smithson mdooli...@gmail.com
 To: mc@gnome.org
 Subject: Re: mc Digest, Vol 116, Issue 5
 Message-ID: op.w8bgl7yqi2b...@timberwolf.electromag.net
 Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-1

 On Tue, 17 Dec 2013 04:00:03 -0800, mc-requ...@gnome.org wrote:


 Message: 1
 Date: Mon, 16 Dec 2013 14:05:48 +
 From: James Wonnacott ja...@tregillis.eclipse.co.uk
 To: mc@gnome.org
 Subject: Changed behaviour of clicking at the top.
 Message-ID: 52af08bc.5020...@tregillis.eclipse.co.uk
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed

 Dear All,

 Sorry to raise this again but it's driving me nuts and I only got one
 reply last time which didn't help.

 ###
 #Warning! if you don't think a mouse is an appropriate#
 #input device to use on mc please don't read any more.#
 #I use a mouse a lot in mc and I like it! #
 ###

 I've been using mc for many years and I love it- thanks!

 I've recently installed version 4.8.3 on a few Debian servers I've built
 and found that I can no longer click at the top of a panel to move up-
 it now reverses the sort order instead.
 Now, I really would like to get the old behaviour back- is this
 possible? please!

 Thanks,

 James.


 It's true. I don't use the mouse much, tend to be a keyboard hotkey
 kind of guy. But your question got me playing with mc  mouse. The
 mouse support seems to be highly improved over the last time (years
 ago) that I fiddled with mouse support.

 If you want to change it, the relevant code is in
 src/filemanager/panel.c, around line 3645:

 [code]
  /* sort on clicked column; don't handle wheel events */
  if (mouse_down  (local.buttons  (GPM_B_UP | GPM_B_DOWN)) == 0 
 local.y == 2)
  {
  mouse_sort_col (panel, local.x);
  goto finish;
  }

  /* Mouse wheel events */
  if (mouse_down  (local.buttons  GPM_B_UP) != 0)
  {
  if (is_active)
  {
  if (panels_options.mouse_move_pages  (panel-top_file  0))
  prev_page (panel);
  else/* We are in first page */
  move_up (panel);
  }
  goto finish;
  }
 [/code]

 Frankly, I like the sort/reverse sort feature. I didn't even know I
 could do that. Very handy. Thank you for drawing it to my attention.


 --
 Peace and Cheer


 --

 Subject: Digest Footer

 ___
 mc mailing list
 https://mail.gnome.org/mailman/listinfo/mc


 --

 End of mc Digest, Vol 116, Issue 6
 **

___
mc mailing list
https://mail.gnome.org/mailman/listinfo/mc


Re: mc Digest, Vol 116, Issue 6

2013-12-19 Thread Mike Smithson

On Thu, 19 Dec 2013 04:00:03 -0800, mc-requ...@gnome.org wrote:


Message: 1
Date: Thu, 19 Dec 2013 00:02:38 +0100
From: Konrad Vrba konrad.v...@gmail.com
To: mc@gnome.org
Subject: disk usage status in right bottom corner
Message-ID:
CAF2Nc0zH_Ew_tbEm44ZS9mJiUiqL0A=iyev1maj6krttyqu...@mail.gmail.com
Content-Type: text/plain; charset=iso-8859-1

hello,

I would like to ask whether it is possible to change the disk  
status/usage

information, which is displayed in the botom right corner in midnight
commander (sorry if I am not using the correct terminology).

The information displayed in my MC is free/total free%

I would prefer to have % of used space, rather than % of free space. It
might seem trivial, but I canot get used to the idea and it still  
confuses
me. It seems to me logical to see what *is*on my disk, rather than what  
*is

not*.

Is there some way to adjust this, so that I can for example see just the
%usage ?

thanks,
Konrad


You know, that confused me too. It shows free space instead of used space.
df shows size used avail and use%, but mc shows avail/size (free%).

Once again, src/filemanager/panels.c being hacked, around line :
[code]
static void
show_free_space (WPanel * panel)
{
/* Used to figure out how many free space we have */
static struct my_statfs myfs_stats;
/* Old current working directory for displaying free space */
static char *old_cwd = NULL;

/* Don't try to stat non-local fs */
if (!vfs_file_is_local (panel-cwd_vpath) || !free_space)
return;

if (old_cwd == NULL || strcmp (old_cwd, vfs_path_as_str  
(panel-cwd_vpath)) != 0)

{
char rpath[PATH_MAX];

init_my_statfs ();
g_free (old_cwd);
old_cwd = g_strdup (vfs_path_as_str (panel-cwd_vpath));

if (mc_realpath (old_cwd, rpath) == NULL)
return;

my_statfs (myfs_stats, rpath);
}

if (myfs_stats.avail != 0 || myfs_stats.total != 0)
{
Widget *w = WIDGET (panel);
char buffer1[6], buffer2[6], tmp[BUF_SMALL];

size_trunc_len (buffer1, sizeof (buffer1) - 1, myfs_stats.avail, 1,
panels_options.kilobyte_si);
size_trunc_len (buffer2, sizeof (buffer2) - 1, myfs_stats.total, 1,
panels_options.kilobyte_si);
g_snprintf (tmp, sizeof (tmp),  %s/%s (%d%%) , buffer1, buffer2,
myfs_stats.total == 0 ? 0 :
(int) (100 * (long double) myfs_stats.avail /  
myfs_stats.total));

widget_move (w, w-lines - 1, w-cols - 2 - (int) strlen (tmp));
tty_setcolor (NORMAL_COLOR);
tty_print_string (tmp);
}
}
[/code]
First, I'd rename the func to panel_show_disk_usage(). Then a bool whether
to show free space or used space. Then mod those size_trunc_len()s on the
bool.

But, in the meantime, for a quick and usable hack, I'd just change that
last bit to:
[code]
if (myfs_stats.avail != 0 || myfs_stats.total != 0)
{
Widget *w = WIDGET (panel);
char buffer1[6], buffer2[6], tmp[BUF_SMALL];
uintmax_t used = myfs_stats.total - myfs_stats.avail;

//size_trunc_len (buffer1, sizeof (buffer1) - 1, myfs_stats.avail,  
1,

//panels_options.kilobyte_si);
size_trunc_len (buffer1, sizeof (buffer1) - 1, used, 1,
panels_options.kilobyte_si);
size_trunc_len (buffer2, sizeof (buffer2) - 1, myfs_stats.total, 1,
panels_options.kilobyte_si);
//g_snprintf (tmp, sizeof (tmp),  %s/%s (%d%%) , buffer1,  
buffer2,

//myfs_stats.total == 0 ? 0 :
//(int) (100 * (long double) myfs_stats.avail /  
myfs_stats.total));
g_snprintf (tmp, sizeof (tmp),  Used %s/%s (%d%%) , buffer1,  
buffer2,

myfs_stats.total == 0 ? 0 :
(int) (100 * (long double) used / myfs_stats.total));
widget_move (w, w-lines - 1, w-cols - 2 - (int) strlen (tmp));
tty_setcolor (NORMAL_COLOR);
tty_print_string (tmp);
}
[/code]

Works for me. I think I'll clean it up and keep it.


--
Peace and Cheer
___
mc mailing list
https://mail.gnome.org/mailman/listinfo/mc