mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 21:06:52 +03:00
Warn user if he enters garbage into panel->user_format.
This commit is contained in:
parent
2030141d95
commit
c164b2cb25
@ -1,3 +1,11 @@
|
||||
1999-06-09 Pavel Machek <pavel@artax.karlin.mff.cuni.cz>
|
||||
|
||||
* cmd.c (configure_panel_listing): no more code duplication
|
||||
|
||||
* screen.c (panel_new): no more code duplication
|
||||
(set_panel_formats): warn user when he gives bogus format, move
|
||||
checks into set_panel_formats
|
||||
|
||||
1999-06-01 Akira Higuchi <a-higuti@math.sci.hokudai.ac.jp>
|
||||
|
||||
* util.c (is_printable): in GNOME all characters are printable.
|
||||
|
16
src/cmd.c
16
src/cmd.c
@ -1411,8 +1411,6 @@ save_setup_cmd (void)
|
||||
void
|
||||
configure_panel_listing (WPanel *p, int view_type, int use_msformat, char *user, char *status)
|
||||
{
|
||||
int err;
|
||||
|
||||
p->user_mini_status = use_msformat;
|
||||
p->list_type = view_type;
|
||||
|
||||
@ -1423,19 +1421,7 @@ configure_panel_listing (WPanel *p, int view_type, int use_msformat, char *user,
|
||||
g_free (p->user_status_format [view_type]);
|
||||
p->user_status_format [view_type] = status;
|
||||
|
||||
err = set_panel_formats (p);
|
||||
|
||||
if (err){
|
||||
if (err & 0x01){
|
||||
g_free (p->user_format);
|
||||
p->user_format = g_strdup (DEFAULT_USER_FORMAT);
|
||||
}
|
||||
|
||||
if (err & 0x02){
|
||||
g_free (p->user_status_format [view_type]);
|
||||
p->user_status_format [view_type] = g_strdup (DEFAULT_USER_FORMAT);
|
||||
}
|
||||
}
|
||||
set_panel_formats (p);
|
||||
}
|
||||
else {
|
||||
g_free (user);
|
||||
|
19
src/screen.c
19
src/screen.c
@ -1021,14 +1021,6 @@ panel_new (char *panel_name)
|
||||
/* Load format strings */
|
||||
err = set_panel_formats (panel);
|
||||
if (err){
|
||||
if (err & 0x01){
|
||||
g_free (panel->user_format);
|
||||
panel->user_format = g_strdup (DEFAULT_USER_FORMAT);
|
||||
}
|
||||
if (err & 0x02){
|
||||
g_free (panel->user_status_format [panel->list_type]);
|
||||
panel->user_status_format [panel->list_type] = g_strdup (DEFAULT_USER_FORMAT);
|
||||
}
|
||||
set_panel_formats (panel);
|
||||
}
|
||||
|
||||
@ -1435,6 +1427,17 @@ set_panel_formats (WPanel *p)
|
||||
|
||||
panel_format_modified (p);
|
||||
panel_update_cols (&(p->widget), p->frame_size);
|
||||
|
||||
if (retcode)
|
||||
message( 1, _(" Warning " ), _( "User suplied format looks invalid, reverting to default." ) );
|
||||
if (retcode & 0x01){
|
||||
g_free (p->user_format);
|
||||
p->user_format = g_strdup (DEFAULT_USER_FORMAT);
|
||||
}
|
||||
if (retcode & 0x02){
|
||||
g_free (p->user_status_format [p->list_type]);
|
||||
p->user_status_format [p->list_type] = g_strdup (DEFAULT_USER_FORMAT);
|
||||
}
|
||||
|
||||
return retcode;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user