* main.c (update_xterm_title_path): New function, display

current path in the xterm window title.
(_do_panel_cd): Call update_xterm_title_path().
(done_mc): Remove final message for the titlebar.
* layout.c: Replace "Xterm hintbar" option with more generic
"Xterm window title".  Update all dependencies.
(setup_panels): Call update_xterm_title_path().
This commit is contained in:
Pavel Roskin 2002-12-26 16:10:45 +00:00
parent acaf2e974e
commit da0c9299ad
7 changed files with 44 additions and 27 deletions

View File

@ -1,3 +1,13 @@
2002-12-21 Adam Byrtek <alpha@debian.org>
* main.c (update_xterm_title_path): New function, display
current path in the xterm window title.
(_do_panel_cd): Call update_xterm_title_path().
(done_mc): Remove final message for the titlebar.
* layout.c: Replace "Xterm hintbar" option with more generic
"Xterm window title". Update all dependencies.
(setup_panels): Call update_xterm_title_path().
2002-12-26 Pavel Roskin <proski@gnu.org>
* utilunix.c (mc_tmpdir): Check temporary directory more

View File

@ -98,8 +98,8 @@ int keybar_visible = 1;
/* Set if the nice message (hint) bar is visible */
int message_visible = 1;
/* Set if you want the message bar shown in xterm title bar to save space */
int xterm_hintbar = 0;
/* Set to show current working dir in xterm window title */
int xterm_title = 1;
/* The starting line for the output of the subprogram */
int output_start_y = 0;
@ -129,7 +129,7 @@ static int _output_lines;
static int _command_prompt;
static int _keybar_visible;
static int _message_visible;
static int _xterm_hintbar;
static int _xterm_title;
static int _permission_mode;
static int _filetype_mode;
@ -161,7 +161,7 @@ static struct {
WCheck *widget;
char *tkname;
} check_options [] = {
{ N_("&Xterm hintbar"), &xterm_hintbar, 0, "h" },
{ N_("&Xterm window title"), &xterm_title, 0, "t" },
{ N_("h&Intbar visible"), &message_visible, 0, "v" },
{ N_("&Keybar visible"), &keybar_visible, 0, "k" },
{ N_("command &Prompt"), &command_prompt, 0, "p" },
@ -312,14 +312,13 @@ static int layout_callback (struct Dlg_head *h, int Id, int Msg)
_command_prompt = check_options [4].widget->state & C_BOOL;
_keybar_visible = check_options [2].widget->state & C_BOOL;
_message_visible = check_options [1].widget->state & C_BOOL;
_xterm_hintbar = check_options [0].widget->state & C_BOOL;
_xterm_title = check_options [0].widget->state & C_BOOL;
if (console_flag){
int minimum;
if (_output_lines < 0)
_output_lines = 0;
height = LINES - _keybar_visible - _command_prompt -
_menubar_visible - _output_lines - _message_visible;
if (_message_visible && _xterm_hintbar && xterm_flag) height++;
minimum = MINHEIGHT * (1 + _horizontal_split);
if (height < minimum){
_output_lines -= minimum - height;
@ -328,7 +327,6 @@ static int layout_callback (struct Dlg_head *h, int Id, int Msg)
} else {
height = LINES - _keybar_visible - _command_prompt -
_menubar_visible - _output_lines - _message_visible;
if (_message_visible && _xterm_hintbar && xterm_flag) height++;
}
if (_horizontal_split != radio_widget->sel){
_horizontal_split = radio_widget->sel;
@ -472,7 +470,7 @@ static void init_layout (void)
_command_prompt = command_prompt;
_keybar_visible = keybar_visible;
_message_visible = message_visible;
_xterm_hintbar = xterm_hintbar;
_xterm_title = xterm_title;
bright_widget = button_new(6, 15, B_2RIGHT, NARROW_BUTTON, "&>", b2right_cback, 0, ">");
add_widget (layout_dlg, bright_widget);
bleft_widget = button_new (6, 9, B_2LEFT, NARROW_BUTTON, "&<", b2left_cback, 0, "<");
@ -647,8 +645,6 @@ setup_panels (void)
output_lines = 0;
height = LINES - keybar_visible - command_prompt - menubar_visible
- output_lines - message_visible;
if (message_visible && xterm_hintbar && xterm_flag)
height++;
minimum = MINHEIGHT * (1 + horizontal_split);
if (height < minimum) {
output_lines -= minimum - height;
@ -657,8 +653,6 @@ setup_panels (void)
} else {
height = LINES - menubar_visible - command_prompt -
keybar_visible - message_visible;
if (message_visible && xterm_hintbar && xterm_flag)
height++;
}
check_split ();
start_y = menubar_visible;
@ -710,12 +704,13 @@ setup_panels (void)
LINES - output_lines - keybar_visible - 1,
LINES - keybar_visible - 1);
}
if (message_visible && (!xterm_hintbar || !xterm_flag))
if (message_visible)
widget_set_size (&the_hint->widget, height + start_y, 0, 1, COLS);
else
widget_set_size (&the_hint->widget, 0, 0, 0, 0);
load_hint ();
update_xterm_title_path ();
}
void flag_winch (int dummy)
@ -803,14 +798,9 @@ void use_dash (int flag)
void set_hintbar(char *str)
{
if (xterm_flag && xterm_hintbar) {
fprintf (stdout, "\33]0;mc - %s\7", str);
fflush (stdout);
} else {
label_set_text (the_hint, str);
if (ok_to_refresh > 0)
refresh();
}
label_set_text (the_hint, str);
if (ok_to_refresh > 0)
refresh();
}
void print_vfs_message (char *msg, ...)
@ -845,7 +835,7 @@ void print_vfs_message (char *msg, ...)
return;
}
if (message_visible || (xterm_flag && xterm_hintbar)) {
if (message_visible) {
set_hintbar(str);
}
}

View File

@ -34,7 +34,7 @@ extern int keybar_visible;
extern int layout_do_change;
extern int output_start_y;
extern int message_visible;
extern int xterm_hintbar;
extern int xterm_title;
extern int horizontal_split;
extern int nice_rotating_dash;

View File

@ -788,6 +788,7 @@ _do_panel_cd (WPanel *panel, char *new_dir, enum cd_enum cd_type)
try_to_select (panel, get_parent_dir_name (panel->cwd, olddir));
load_hint ();
panel_update_contents (panel);
update_xterm_title_path ();
g_free (olddir);
@ -1652,8 +1653,6 @@ done_mc (void)
save_hotlist ();
done_screen ();
vfs_add_current_stamps ();
if (xterm_flag && xterm_hintbar)
set_hintbar (_("Thank you for using GNU Midnight Commander"));
}
/* This should be called after destroy_dlg since panel widgets
@ -1836,6 +1835,22 @@ midnight_callback (struct Dlg_head *h, int id, int msg)
#define xtoolkit_panel_setup()
void
update_xterm_title_path (void)
{
unsigned char *p, *s;
if (xterm_flag && xterm_title) {
p = s = g_strdup (strip_home_and_password (cpanel->cwd));
do {
if (*s <= 32)
*s = '?';
} while (*++s);
fprintf (stdout, "\33]0;mc - %s\7", p);
fflush (stdout);
g_free (p);
}
}
void
load_hint (void)
{
@ -1844,7 +1859,7 @@ load_hint (void)
if (!the_hint->widget.parent)
return;
if (!message_visible && (!xterm_flag || !xterm_hintbar)) {
if (!message_visible) {
label_set_text (the_hint, 0);
return;
}

View File

@ -130,6 +130,7 @@ int quiet_quit_cmd (void); /* For cmd.c and command.c */
void untouch_bar (void);
void touch_bar (void);
void update_xterm_title_path (void);
void load_hint (void);
void print_vfs_message(char *msg, ...)

View File

@ -2171,6 +2171,7 @@ panel_callback (WPanel *panel, int msg, int par)
} else
subshell_chdir (panel->cwd);
update_xterm_title_path ();
show_dir (panel);
select_item (panel);

View File

@ -121,7 +121,7 @@ static const struct {
{ "first_panel_size", &first_panel_size },
{ "message_visible", &message_visible },
{ "keybar_visible", &keybar_visible },
{ "xterm_hintbar", &xterm_hintbar },
{ "xterm_title", &xterm_title },
{ "output_lines", &output_lines },
{ "command_prompt", &command_prompt },
{ "menubar_visible", &menubar_visible },