2 Main dialog (file panels) of the Midnight Commander
4 Copyright (C) 1994-2024
5 Free Software Foundation, Inc.
8 Miguel de Icaza, 1994, 1995, 1996, 1997
9 Janne Kukonlehto, 1994, 1995
11 Andrew Borodin <aborodin@vmail.ru>, 2009-2022
12 Slava Zanko <slavazanko@gmail.com>, 2013
14 This file is part of the Midnight Commander.
16 The Midnight Commander is free software: you can redistribute it
17 and/or modify it under the terms of the GNU General Public License as
18 published by the Free Software Foundation, either version 3 of the License,
19 or (at your option) any later version.
21 The Midnight Commander is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 GNU General Public License for more details.
26 You should have received a copy of the GNU General Public License
27 along with this program. If not, see <http://www.gnu.org/licenses/>.
30 /** \file filemanager.c
31 * \brief Source: main dialog (file panels) of the Midnight Commander
41 #include <sys/types.h>
44 #include <pwd.h> /* for username in xterm title */
46 #include "lib/global.h"
47 #include "lib/fileloc.h" /* MC_HINT */
49 #include "lib/tty/tty.h"
50 #include "lib/tty/key.h" /* KEY_M_* masks */
54 #include "lib/vfs/vfs.h"
57 #ifdef ENABLE_SUBSHELL
58 #include "src/subshell/subshell.h"
60 #include "src/execute.h" /* toggle_subshell */
61 #include "src/setup.h" /* variables */
62 #include "src/learn.h" /* learn_keys() */
63 #include "src/keymap.h"
64 #include "lib/fileloc.h" /* MC_FILEPOS_FILE */
65 #include "lib/keybind.h"
66 #include "lib/event.h"
69 #include "boxes.h" /* sort_box(), tree_box() */
71 #include "cmd.h" /* commands */
74 #include "command.h" /* cmdline */
75 #include "dir.h" /* dir_list_clean() */
77 #ifdef USE_INTERNAL_EDIT
78 #include "src/editor/edit.h"
82 #include "src/diffviewer/ydiff.h"
85 #include "src/consaver/cons.saver.h" /* show_console_contents */
86 #include "src/file_history.h" /* show_file_history() */
88 #include "filemanager.h"
90 /*** global variables ****************************************************************************/
92 /* When the modes are active, left_panel, right_panel and tree_panel */
93 /* point to a proper data structure. You should check with the functions */
94 /* get_current_type and get_other_type the types of the panels before using */
95 /* this pointer variables */
97 /* The structures for the panels */
98 WPanel
*left_panel
= NULL
;
99 WPanel
*right_panel
= NULL
;
100 /* Pointer to the selected and unselected panel */
101 WPanel
*current_panel
= NULL
;
104 WMenuBar
*the_menubar
= NULL
;
105 /* The widget where we draw the prompt */
113 const char *mc_prompt
= NULL
;
115 /*** file scope macro definitions ****************************************************************/
119 * Don't restrict the output on the screen manager level,
120 * the translation tables take care of it.
122 #endif /* !HAVE_CHARSET */
124 /*** file scope type declarations ****************************************************************/
126 /*** forward declarations (file scope functions) *************************************************/
128 /*** file scope variables ************************************************************************/
130 static menu_t
*left_menu
, *right_menu
;
132 /* --------------------------------------------------------------------------------------------- */
133 /*** file scope functions ************************************************************************/
134 /* --------------------------------------------------------------------------------------------- */
136 /** Stop MC main dialog and the current dialog if it exists.
137 * Needed to provide fast exit from MC viewer or editor on shell exit */
141 dlg_close (filemanager
);
144 dlg_close (DIALOG (top_dlg
->data
));
147 /* --------------------------------------------------------------------------------------------- */
154 sel_dir
= tree_box (panel_current_entry (current_panel
)->fname
->str
);
157 vfs_path_t
*sel_vdir
;
159 sel_vdir
= vfs_path_from_str (sel_dir
);
160 panel_cd (current_panel
, sel_vdir
, cd_exact
);
161 vfs_path_free (sel_vdir
, TRUE
);
166 /* --------------------------------------------------------------------------------------------- */
168 #ifdef LISTMODE_EDITOR
174 if (get_current_type () != view_listing
)
177 newmode
= listmode_edit (current_panel
->user_format
);
181 g_free (current_panel
->user_format
);
182 current_panel
->list_format
= list_user
;
183 current_panel
->user_format
= newmode
;
184 set_panel_formats (current_panel
);
188 #endif /* LISTMODE_EDITOR */
190 /* --------------------------------------------------------------------------------------------- */
193 create_panel_menu (void)
195 GList
*entries
= NULL
;
197 entries
= g_list_prepend (entries
, menu_entry_new (_("File listin&g"), CK_PanelListing
));
198 entries
= g_list_prepend (entries
, menu_entry_new (_("&Quick view"), CK_PanelQuickView
));
199 entries
= g_list_prepend (entries
, menu_entry_new (_("&Info"), CK_PanelInfo
));
200 entries
= g_list_prepend (entries
, menu_entry_new (_("&Tree"), CK_PanelTree
));
201 entries
= g_list_prepend (entries
, menu_separator_new ());
203 g_list_prepend (entries
, menu_entry_new (_("&Listing format..."), CK_SetupListingFormat
));
204 entries
= g_list_prepend (entries
, menu_entry_new (_("&Sort order..."), CK_Sort
));
205 entries
= g_list_prepend (entries
, menu_entry_new (_("&Filter..."), CK_Filter
));
207 entries
= g_list_prepend (entries
, menu_entry_new (_("&Encoding..."), CK_SelectCodepage
));
209 entries
= g_list_prepend (entries
, menu_separator_new ());
210 #ifdef ENABLE_VFS_FTP
211 entries
= g_list_prepend (entries
, menu_entry_new (_("FT&P link..."), CK_ConnectFtp
));
213 #ifdef ENABLE_VFS_SHELL
214 entries
= g_list_prepend (entries
, menu_entry_new (_("S&hell link..."), CK_ConnectShell
));
216 #ifdef ENABLE_VFS_SFTP
217 entries
= g_list_prepend (entries
, menu_entry_new (_("SFTP li&nk..."), CK_ConnectSftp
));
219 entries
= g_list_prepend (entries
, menu_entry_new (_("Paneli&ze"), CK_Panelize
));
220 entries
= g_list_prepend (entries
, menu_separator_new ());
221 entries
= g_list_prepend (entries
, menu_entry_new (_("&Rescan"), CK_Reread
));
223 return g_list_reverse (entries
);
226 /* --------------------------------------------------------------------------------------------- */
229 create_file_menu (void)
231 GList
*entries
= NULL
;
233 entries
= g_list_prepend (entries
, menu_entry_new (_("&View"), CK_View
));
234 entries
= g_list_prepend (entries
, menu_entry_new (_("Vie&w file..."), CK_ViewFile
));
235 entries
= g_list_prepend (entries
, menu_entry_new (_("&Filtered view"), CK_ViewFiltered
));
236 entries
= g_list_prepend (entries
, menu_entry_new (_("&Edit"), CK_Edit
));
237 entries
= g_list_prepend (entries
, menu_entry_new (_("&Copy"), CK_Copy
));
238 entries
= g_list_prepend (entries
, menu_entry_new (_("C&hmod"), CK_ChangeMode
));
239 entries
= g_list_prepend (entries
, menu_entry_new (_("&Link"), CK_Link
));
240 entries
= g_list_prepend (entries
, menu_entry_new (_("&Symlink"), CK_LinkSymbolic
));
242 g_list_prepend (entries
, menu_entry_new (_("Relative symlin&k"), CK_LinkSymbolicRelative
));
243 entries
= g_list_prepend (entries
, menu_entry_new (_("Edit s&ymlink"), CK_LinkSymbolicEdit
));
244 entries
= g_list_prepend (entries
, menu_entry_new (_("Ch&own"), CK_ChangeOwn
));
245 entries
= g_list_prepend (entries
, menu_entry_new (_("&Advanced chown"), CK_ChangeOwnAdvanced
));
246 #ifdef ENABLE_EXT2FS_ATTR
247 entries
= g_list_prepend (entries
, menu_entry_new (_("Cha&ttr"), CK_ChangeAttributes
));
249 entries
= g_list_prepend (entries
, menu_entry_new (_("&Rename/Move"), CK_Move
));
250 entries
= g_list_prepend (entries
, menu_entry_new (_("&Mkdir"), CK_MakeDir
));
251 entries
= g_list_prepend (entries
, menu_entry_new (_("&Delete"), CK_Delete
));
252 entries
= g_list_prepend (entries
, menu_entry_new (_("&Quick cd"), CK_CdQuick
));
253 entries
= g_list_prepend (entries
, menu_separator_new ());
254 entries
= g_list_prepend (entries
, menu_entry_new (_("Select &group"), CK_Select
));
255 entries
= g_list_prepend (entries
, menu_entry_new (_("U&nselect group"), CK_Unselect
));
256 entries
= g_list_prepend (entries
, menu_entry_new (_("&Invert selection"), CK_SelectInvert
));
257 entries
= g_list_prepend (entries
, menu_separator_new ());
258 entries
= g_list_prepend (entries
, menu_entry_new (_("E&xit"), CK_Quit
));
260 return g_list_reverse (entries
);
263 /* --------------------------------------------------------------------------------------------- */
266 create_command_menu (void)
268 /* I know, I'm lazy, but the tree widget when it's not running
269 * as a panel still has some problems, I have not yet finished
270 * the WTree widget port, sorry.
272 GList
*entries
= NULL
;
274 entries
= g_list_prepend (entries
, menu_entry_new (_("&User menu"), CK_UserMenu
));
275 entries
= g_list_prepend (entries
, menu_entry_new (_("&Directory tree"), CK_Tree
));
276 entries
= g_list_prepend (entries
, menu_entry_new (_("&Find file"), CK_Find
));
277 entries
= g_list_prepend (entries
, menu_entry_new (_("S&wap panels"), CK_Swap
));
278 entries
= g_list_prepend (entries
, menu_entry_new (_("Switch &panels on/off"), CK_Shell
));
279 entries
= g_list_prepend (entries
, menu_entry_new (_("&Compare directories"), CK_CompareDirs
));
281 entries
= g_list_prepend (entries
, menu_entry_new (_("C&ompare files"), CK_CompareFiles
));
284 g_list_prepend (entries
, menu_entry_new (_("E&xternal panelize"), CK_ExternalPanelize
));
285 entries
= g_list_prepend (entries
, menu_entry_new (_("Show directory s&izes"), CK_DirSize
));
286 entries
= g_list_prepend (entries
, menu_separator_new ());
287 entries
= g_list_prepend (entries
, menu_entry_new (_("Command &history"), CK_History
));
289 g_list_prepend (entries
,
290 menu_entry_new (_("Viewed/edited files hi&story"), CK_EditorViewerHistory
));
291 entries
= g_list_prepend (entries
, menu_entry_new (_("Di&rectory hotlist"), CK_HotList
));
293 entries
= g_list_prepend (entries
, menu_entry_new (_("&Active VFS list"), CK_VfsList
));
295 #ifdef ENABLE_BACKGROUND
296 entries
= g_list_prepend (entries
, menu_entry_new (_("&Background jobs"), CK_Jobs
));
298 entries
= g_list_prepend (entries
, menu_entry_new (_("Screen lis&t"), CK_ScreenList
));
299 entries
= g_list_prepend (entries
, menu_separator_new ());
300 #ifdef ENABLE_VFS_UNDELFS
302 g_list_prepend (entries
, menu_entry_new (_("&Undelete files (ext2fs only)"), CK_Undelete
));
304 #ifdef LISTMODE_EDITOR
305 entries
= g_list_prepend (entries
, menu_entry_new (_("&Listing format edit"), CK_ListMode
));
307 #if defined (ENABLE_VFS_UNDELFS) || defined (LISTMODE_EDITOR)
308 entries
= g_list_prepend (entries
, menu_separator_new ());
311 g_list_prepend (entries
, menu_entry_new (_("Edit &extension file"), CK_EditExtensionsFile
));
312 entries
= g_list_prepend (entries
, menu_entry_new (_("Edit &menu file"), CK_EditUserMenu
));
314 g_list_prepend (entries
,
315 menu_entry_new (_("Edit hi&ghlighting group file"),
316 CK_EditFileHighlightFile
));
318 return g_list_reverse (entries
);
321 /* --------------------------------------------------------------------------------------------- */
324 create_options_menu (void)
326 GList
*entries
= NULL
;
328 entries
= g_list_prepend (entries
, menu_entry_new (_("&Configuration..."), CK_Options
));
329 entries
= g_list_prepend (entries
, menu_entry_new (_("&Layout..."), CK_OptionsLayout
));
330 entries
= g_list_prepend (entries
, menu_entry_new (_("&Panel options..."), CK_OptionsPanel
));
331 entries
= g_list_prepend (entries
, menu_entry_new (_("C&onfirmation..."), CK_OptionsConfirm
));
332 entries
= g_list_prepend (entries
, menu_entry_new (_("&Appearance..."), CK_OptionsAppearance
));
334 g_list_prepend (entries
, menu_entry_new (_("&Display bits..."), CK_OptionsDisplayBits
));
335 entries
= g_list_prepend (entries
, menu_entry_new (_("Learn &keys..."), CK_LearnKeys
));
337 entries
= g_list_prepend (entries
, menu_entry_new (_("&Virtual FS..."), CK_OptionsVfs
));
339 entries
= g_list_prepend (entries
, menu_separator_new ());
340 entries
= g_list_prepend (entries
, menu_entry_new (_("&Save setup"), CK_SaveSetup
));
342 return g_list_reverse (entries
);
345 /* --------------------------------------------------------------------------------------------- */
350 left_menu
= menu_new ("", create_panel_menu (), "[Left and Right Menus]");
351 menubar_add_menu (the_menubar
, left_menu
);
352 menubar_add_menu (the_menubar
, menu_new (_("&File"), create_file_menu (), "[File Menu]"));
353 menubar_add_menu (the_menubar
,
354 menu_new (_("&Command"), create_command_menu (), "[Command Menu]"));
355 menubar_add_menu (the_menubar
,
356 menu_new (_("&Options"), create_options_menu (), "[Options Menu]"));
357 right_menu
= menu_new ("", create_panel_menu (), "[Left and Right Menus]");
358 menubar_add_menu (the_menubar
, right_menu
);
362 /* --------------------------------------------------------------------------------------------- */
365 menu_last_selected_cmd (void)
367 menubar_activate (the_menubar
, drop_menus
, -1);
370 /* --------------------------------------------------------------------------------------------- */
377 if ((get_current_index () == 0) == current_panel
->active
)
380 selected
= g_list_length (the_menubar
->menu
) - 1;
382 menubar_activate (the_menubar
, drop_menus
, selected
);
385 /* --------------------------------------------------------------------------------------------- */
391 const panel_field_t
*sort_order
;
393 if (!SELECTED_IS_PANEL
)
397 sort_order
= sort_box (&p
->sort_info
, p
->sort_field
);
398 panel_set_sort_order (p
, sort_order
);
401 /* --------------------------------------------------------------------------------------------- */
404 midnight_get_shortcut (long command
)
407 const char *shortcut
= NULL
;
409 shortcut
= keybind_lookup_keymap_shortcut (filemanager_map
, command
);
410 if (shortcut
!= NULL
)
411 return g_strdup (shortcut
);
413 shortcut
= keybind_lookup_keymap_shortcut (panel_map
, command
);
414 if (shortcut
!= NULL
)
415 return g_strdup (shortcut
);
417 ext_map
= keybind_lookup_keymap_shortcut (filemanager_map
, CK_ExtendedKeyMap
);
419 shortcut
= keybind_lookup_keymap_shortcut (filemanager_x_map
, command
);
420 if (shortcut
!= NULL
)
421 return g_strdup_printf ("%s %s", ext_map
, shortcut
);
426 /* --------------------------------------------------------------------------------------------- */
429 midnight_get_title (const WDialog
* h
, size_t len
)
437 title_path_prepare (&path
, &login
);
439 p
= g_strdup_printf ("%s [%s]:%s", _("Panels:"), login
, path
);
442 path
= g_strdup (str_trunc (p
, len
- 4));
448 /* --------------------------------------------------------------------------------------------- */
451 toggle_panels_split (void)
453 panels_layout
.horizontal_split
= !panels_layout
.horizontal_split
;
458 /* --------------------------------------------------------------------------------------------- */
463 check_panel_timestamp (const WPanel
* panel
, panel_view_mode_t mode
, const struct vfs_class
*vclass
,
466 return (mode
!= view_listing
|| (vfs_path_get_last_path_vfs (panel
->cwd_vpath
) == vclass
467 && vfs_getid (panel
->cwd_vpath
) == id
));
470 /* --------------------------------------------------------------------------------------------- */
474 check_current_panel_timestamp (const gchar
* event_group_name
, const gchar
* event_name
,
475 gpointer init_data
, gpointer data
)
477 ev_vfs_stamp_create_t
*event_data
= (ev_vfs_stamp_create_t
*) data
;
479 (void) event_group_name
;
484 check_panel_timestamp (current_panel
, get_current_type (), event_data
->vclass
,
486 return !event_data
->ret
;
489 /* --------------------------------------------------------------------------------------------- */
493 check_other_panel_timestamp (const gchar
* event_group_name
, const gchar
* event_name
,
494 gpointer init_data
, gpointer data
)
496 ev_vfs_stamp_create_t
*event_data
= (ev_vfs_stamp_create_t
*) data
;
498 (void) event_group_name
;
503 check_panel_timestamp (other_panel
, get_other_type (), event_data
->vclass
, event_data
->id
);
504 return !event_data
->ret
;
506 #endif /* ENABLE_VFS */
508 /* --------------------------------------------------------------------------------------------- */
512 print_vfs_message (const gchar
* event_group_name
, const gchar
* event_name
,
513 gpointer init_data
, gpointer data
)
515 ev_vfs_print_message_t
*event_data
= (ev_vfs_print_message_t
*) data
;
517 (void) event_group_name
;
521 if (mc_global
.midnight_shutdown
)
524 if (!mc_global
.message_visible
|| the_hint
== NULL
|| WIDGET (the_hint
)->owner
== NULL
)
528 if (!nice_rotating_dash
|| (ok_to_refresh
<= 0))
531 /* Preserve current cursor position */
532 tty_getyx (&row
, &col
);
535 tty_setcolor (NORMAL_COLOR
);
536 tty_print_string (str_fit_to_term (event_data
->msg
, COLS
- 1, J_LEFT
));
538 /* Restore cursor position */
539 tty_gotoyx (row
, col
);
544 if (mc_global
.message_visible
)
545 set_hintbar (event_data
->msg
);
548 MC_PTR_FREE (event_data
->msg
);
552 /* --------------------------------------------------------------------------------------------- */
557 int current_index
, other_index
;
558 panel_view_mode_t current_mode
, other_mode
;
559 char *current_dir
, *other_dir
;
560 vfs_path_t
*original_dir
;
563 * Following cases from command line are possible:
564 * 'mc' (no arguments): mc_run_param0 == NULL, mc_run_param1 == NULL
565 * active panel uses current directory
566 * passive panel uses "other_dir" from panels.ini
568 * 'mc dir1 dir2' (two arguments): mc_run_param0 != NULL, mc_run_param1 != NULL
569 * active panel uses mc_run_param0
570 * passive panel uses mc_run_param1
572 * 'mc dir1' (single argument): mc_run_param0 != NULL, mc_run_param1 == NULL
573 * active panel uses mc_run_param0
574 * passive panel uses "other_dir" from panels.ini
577 /* Set up panel directories */
578 if (boot_current_is_left
)
580 /* left panel is active */
583 current_mode
= startup_left_mode
;
584 other_mode
= startup_right_mode
;
586 if (mc_run_param0
== NULL
&& mc_run_param1
== NULL
)
589 current_dir
= NULL
; /* assume current dir */
590 other_dir
= saved_other_dir
; /* from ini */
592 else if (mc_run_param0
!= NULL
&& mc_run_param1
!= NULL
)
595 current_dir
= (char *) mc_run_param0
;
596 other_dir
= mc_run_param1
;
598 else /* mc_run_param0 != NULL && mc_run_param1 == NULL */
601 current_dir
= (char *) mc_run_param0
;
602 other_dir
= saved_other_dir
; /* from ini */
607 /* right panel is active */
610 current_mode
= startup_right_mode
;
611 other_mode
= startup_left_mode
;
613 if (mc_run_param0
== NULL
&& mc_run_param1
== NULL
)
616 current_dir
= NULL
; /* assume current dir */
617 other_dir
= saved_other_dir
; /* from ini */
619 else if (mc_run_param0
!= NULL
&& mc_run_param1
!= NULL
)
622 current_dir
= (char *) mc_run_param0
;
623 other_dir
= mc_run_param1
;
625 else /* mc_run_param0 != NULL && mc_run_param1 == NULL */
628 current_dir
= (char *) mc_run_param0
;
629 other_dir
= saved_other_dir
; /* from ini */
633 /* 1. Get current dir */
634 original_dir
= vfs_path_clone (vfs_get_raw_current_dir ());
636 /* 2. Create passive panel */
637 if (other_dir
!= NULL
)
641 if (g_path_is_absolute (other_dir
))
642 vpath
= vfs_path_from_str (other_dir
);
644 vpath
= vfs_path_append_new (original_dir
, other_dir
, (char *) NULL
);
646 vfs_path_free (vpath
, TRUE
);
648 create_panel (other_index
, other_mode
);
650 /* 3. Create active panel */
651 if (current_dir
== NULL
)
652 mc_chdir (original_dir
);
657 if (g_path_is_absolute (current_dir
))
658 vpath
= vfs_path_from_str (current_dir
);
660 vpath
= vfs_path_append_new (original_dir
, current_dir
, (char *) NULL
);
662 vfs_path_free (vpath
, TRUE
);
664 create_panel (current_index
, current_mode
);
666 if (startup_left_mode
== view_listing
)
667 current_panel
= left_panel
;
668 else if (right_panel
!= NULL
)
669 current_panel
= right_panel
;
671 current_panel
= left_panel
;
673 vfs_path_free (original_dir
, TRUE
);
676 mc_event_add (MCEVENT_GROUP_CORE
, "vfs_timestamp", check_other_panel_timestamp
, NULL
, NULL
);
677 mc_event_add (MCEVENT_GROUP_CORE
, "vfs_timestamp", check_current_panel_timestamp
, NULL
, NULL
);
678 #endif /* ENABLE_VFS */
680 mc_event_add (MCEVENT_GROUP_CORE
, "vfs_print_message", print_vfs_message
, NULL
, NULL
);
683 /* --------------------------------------------------------------------------------------------- */
686 midnight_put_panel_path (WPanel
* panel
)
688 vfs_path_t
*cwd_vpath
;
689 const char *cwd_vpath_str
;
695 cwd_vpath
= remove_encoding_from_path (panel
->cwd_vpath
);
697 cwd_vpath
= vfs_path_clone (panel
->cwd_vpath
);
700 cwd_vpath_str
= vfs_path_as_str (cwd_vpath
);
702 command_insert (cmdline
, cwd_vpath_str
, FALSE
);
704 if (!IS_PATH_SEP (cwd_vpath_str
[strlen (cwd_vpath_str
) - 1]))
705 command_insert (cmdline
, PATH_SEP_STR
, FALSE
);
707 vfs_path_free (cwd_vpath
, TRUE
);
710 /* --------------------------------------------------------------------------------------------- */
713 put_link (WPanel
* panel
)
715 const file_entry_t
*fe
;
720 fe
= panel_current_entry (panel
);
722 if (S_ISLNK (fe
->st
.st_mode
))
724 char buffer
[MC_MAXPATHLEN
];
728 vpath
= vfs_path_append_new (panel
->cwd_vpath
, fe
->fname
->str
, (char *) NULL
);
729 i
= mc_readlink (vpath
, buffer
, sizeof (buffer
) - 1);
730 vfs_path_free (vpath
, TRUE
);
735 command_insert (cmdline
, buffer
, TRUE
);
740 /* --------------------------------------------------------------------------------------------- */
743 put_current_link (void)
745 put_link (current_panel
);
748 /* --------------------------------------------------------------------------------------------- */
751 put_other_link (void)
753 if (get_other_type () == view_listing
)
754 put_link (other_panel
);
757 /* --------------------------------------------------------------------------------------------- */
759 /** Insert the selected file name into the input line */
761 put_current_selected (void)
768 if (get_current_type () == view_tree
)
771 const vfs_path_t
*selected_name
;
773 tree
= (WTree
*) get_panel_widget (get_current_index ());
774 selected_name
= tree_selected_name (tree
);
775 tmp
= vfs_path_as_str (selected_name
);
778 tmp
= panel_current_entry (current_panel
)->fname
->str
;
780 command_insert (cmdline
, tmp
, TRUE
);
783 /* --------------------------------------------------------------------------------------------- */
786 put_tagged (WPanel
* panel
)
791 input_disable_update (cmdline
);
793 if (panel
->marked
== 0)
794 command_insert (cmdline
, panel_current_entry (panel
)->fname
->str
, TRUE
);
799 for (i
= 0; i
< panel
->dir
.len
; i
++)
800 if (panel
->dir
.list
[i
].f
.marked
!= 0)
801 command_insert (cmdline
, panel
->dir
.list
[i
].fname
->str
, TRUE
);
804 input_enable_update (cmdline
);
807 /* --------------------------------------------------------------------------------------------- */
810 put_current_tagged (void)
812 put_tagged (current_panel
);
815 /* --------------------------------------------------------------------------------------------- */
818 put_other_tagged (void)
820 if (get_other_type () == view_listing
)
821 put_tagged (other_panel
);
824 /* --------------------------------------------------------------------------------------------- */
831 tty_display_8bit (TRUE
);
833 tty_display_8bit (mc_global
.full_eight_bits
);
834 #endif /* HAVE_CHARSET */
836 #else /* HAVE_SLANG */
839 tty_display_8bit (TRUE
);
841 tty_display_8bit (mc_global
.eight_bit_clean
);
842 #endif /* HAVE_CHARSET */
843 #endif /* HAVE_SLANG */
845 if ((tty_baudrate () < 9600) || mc_global
.tty
.slow_terminal
)
849 /* --------------------------------------------------------------------------------------------- */
852 setup_dummy_mc (void)
860 vpath
= vfs_path_from_str (d
);
861 ret
= mc_chdir (vpath
);
863 vfs_path_free (vpath
, TRUE
);
867 /* --------------------------------------------------------------------------------------------- */
874 * We sync the profiles since the hotlist may have changed, while
875 * we only change the setup data if we have the auto save feature set
878 save_setup (auto_save_setup
, panels_options
.auto_save_setup
);
880 vfs_stamp_path (vfs_get_raw_current_dir ());
883 /* --------------------------------------------------------------------------------------------- */
886 create_file_manager (void)
888 Widget
*w
= WIDGET (filemanager
);
889 WGroup
*g
= GROUP (filemanager
);
891 w
->keymap
= filemanager_map
;
892 w
->ext_keymap
= filemanager_x_map
;
894 filemanager
->get_shortcut
= midnight_get_shortcut
;
895 filemanager
->get_title
= midnight_get_title
;
896 /* allow rebind tab */
897 widget_want_tab (w
, TRUE
);
899 the_menubar
= menubar_new (NULL
);
900 group_add_widget (g
, the_menubar
);
904 group_add_widget (g
, get_panel_widget (0));
905 group_add_widget (g
, get_panel_widget (1));
907 the_hint
= label_new (0, 0, NULL
);
908 the_hint
->transparent
= TRUE
;
909 the_hint
->auto_adjust_cols
= 0;
910 WIDGET (the_hint
)->rect
.cols
= COLS
;
911 group_add_widget (g
, the_hint
);
913 cmdline
= command_new (0, 0, 0);
914 group_add_widget (g
, cmdline
);
916 the_prompt
= label_new (0, 0, mc_prompt
);
917 the_prompt
->transparent
= TRUE
;
918 group_add_widget (g
, the_prompt
);
920 the_bar
= buttonbar_new ();
921 group_add_widget (g
, the_bar
);
922 midnight_set_buttonbar (the_bar
);
924 #ifdef ENABLE_SUBSHELL
925 /* Must be done after creation of cmdline and prompt widgets to avoid potential
926 NULL dereference in load_prompt() -> ... -> setup_cmdline() -> label_set_text(). */
927 if (mc_global
.tty
.use_subshell
)
928 add_select_channel (mc_global
.tty
.subshell_pty
, load_prompt
, NULL
);
929 #endif /* !ENABLE_SUBSHELL */
932 /* --------------------------------------------------------------------------------------------- */
934 /** result must be free'd (I think this should go in util.c) */
936 prepend_cwd_on_local (const char *filename
)
940 vpath
= vfs_path_from_str (filename
);
941 if (!vfs_file_is_local (vpath
) || g_path_is_absolute (filename
))
944 vfs_path_free (vpath
, TRUE
);
946 return vfs_path_append_new (vfs_get_raw_current_dir (), filename
, (char *) NULL
);
949 /* --------------------------------------------------------------------------------------------- */
951 /** Invoke the internal view/edit routine with:
952 * the default processing and forcing the internal viewer/editor
955 mc_maybe_editor_or_viewer (void)
959 switch (mc_global
.mc_run_mode
)
961 #ifdef USE_INTERNAL_EDIT
963 ret
= edit_files ((GList
*) mc_run_param0
);
965 #endif /* USE_INTERNAL_EDIT */
968 vfs_path_t
*vpath
= NULL
;
970 if (mc_run_param0
!= NULL
&& *(char *) mc_run_param0
!= '\0')
971 vpath
= prepend_cwd_on_local ((char *) mc_run_param0
);
973 ret
= view_file (vpath
, FALSE
, TRUE
);
974 vfs_path_free (vpath
, TRUE
);
978 case MC_RUN_DIFFVIEWER
:
979 ret
= dview_diff_cmd (mc_run_param0
, mc_run_param1
);
981 #endif /* USE_DIFF_VIEW */
989 /* --------------------------------------------------------------------------------------------- */
992 show_editor_viewer_history (void)
997 s
= show_file_history (WIDGET (filemanager
), &act
);
1000 vfs_path_t
*s_vpath
;
1005 s_vpath
= vfs_path_from_str (s
);
1006 edit_file_at_line (s_vpath
, use_internal_edit
, 0);
1010 s_vpath
= vfs_path_from_str (s
);
1011 view_file (s_vpath
, use_internal_view
, FALSE
);
1018 d
= g_path_get_dirname (s
);
1019 s_vpath
= vfs_path_from_str (d
);
1020 panel_cd (current_panel
, s_vpath
, cd_exact
);
1021 panel_set_current_by_name (current_panel
, s
);
1027 vfs_path_free (s_vpath
, TRUE
);
1031 /* --------------------------------------------------------------------------------------------- */
1034 quit_cmd_internal (int quiet
)
1039 n
= dialog_switch_num () - 1;
1042 char msg
[BUF_MEDIUM
];
1044 g_snprintf (msg
, sizeof (msg
),
1045 ngettext ("You have %zu opened screen. Quit anyway?",
1046 "You have %zu opened screens. Quit anyway?", n
), n
);
1048 if (query_dialog (_("The Midnight Commander"), msg
, D_NORMAL
, 2, _("&Yes"), _("&No")) != 0)
1052 else if (quiet
|| !confirm_exit
)
1054 else if (query_dialog (_("The Midnight Commander"),
1055 _("Do you really want to quit the Midnight Commander?"),
1056 D_NORMAL
, 2, _("&Yes"), _("&No")) == 0)
1061 #ifdef ENABLE_SUBSHELL
1062 if (!mc_global
.tty
.use_subshell
)
1064 else if ((q
= exit_subshell ()? 1 : 0) != 0)
1074 /* --------------------------------------------------------------------------------------------- */
1079 return quit_cmd_internal (0);
1082 /* --------------------------------------------------------------------------------------------- */
1085 * Repaint the contents of the panels without frames. To schedule panel
1086 * for repainting, set panel->dirty to TRUE. There are many reasons why
1087 * the panels need to be repainted, and this is a costly operation, so
1088 * it's done once per event.
1092 update_dirty_panels (void)
1094 if (get_current_type () == view_listing
&& current_panel
->dirty
)
1095 widget_draw (WIDGET (current_panel
));
1097 if (get_other_type () == view_listing
&& other_panel
->dirty
)
1098 widget_draw (WIDGET (other_panel
));
1101 /* --------------------------------------------------------------------------------------------- */
1104 toggle_show_hidden (void)
1106 panels_options
.show_dot_files
= !panels_options
.show_dot_files
;
1107 update_panels (UP_RELOAD
, UP_KEEPSEL
);
1108 /* redraw panels forced */
1109 update_dirty_panels ();
1112 /* --------------------------------------------------------------------------------------------- */
1115 midnight_execute_cmd (Widget
* sender
, long command
)
1117 cb_ret_t res
= MSG_HANDLED
;
1121 /* stop quick search before executing any command */
1122 send_message (current_panel
, NULL
, MSG_ACTION
, CK_SearchStop
, NULL
);
1126 case CK_ChangePanel
:
1127 (void) change_panel ();
1130 add2hotlist_cmd (current_panel
);
1132 case CK_SetupListingFormat
:
1133 setup_listing_format_cmd ();
1136 chmod_cmd (current_panel
);
1139 chown_cmd (current_panel
);
1141 case CK_ChangeOwnAdvanced
:
1142 advanced_chown_cmd (current_panel
);
1144 #ifdef ENABLE_EXT2FS_ATTR
1145 case CK_ChangeAttributes
:
1146 chattr_cmd (current_panel
);
1149 case CK_CompareDirs
:
1150 compare_dirs_cmd ();
1157 configure_vfs_box ();
1160 case CK_OptionsConfirm
:
1164 copy_cmd (current_panel
);
1166 case CK_PutCurrentPath
:
1167 midnight_put_panel_path (current_panel
);
1169 case CK_PutCurrentSelected
:
1170 put_current_selected ();
1172 case CK_PutCurrentFullSelected
:
1173 midnight_put_panel_path (current_panel
);
1174 put_current_selected ();
1176 case CK_PutCurrentLink
:
1177 put_current_link ();
1179 case CK_PutCurrentTagged
:
1180 put_current_tagged ();
1182 case CK_PutOtherPath
:
1183 if (get_other_type () == view_listing
)
1184 midnight_put_panel_path (other_panel
);
1186 case CK_PutOtherLink
:
1189 case CK_PutOtherTagged
:
1190 put_other_tagged ();
1193 delete_cmd (current_panel
);
1196 dialog_switch_list ();
1198 #ifdef USE_DIFF_VIEW
1199 case CK_CompareFiles
:
1203 case CK_OptionsDisplayBits
:
1204 display_bits_box ();
1207 edit_cmd (current_panel
);
1209 #ifdef USE_INTERNAL_EDIT
1210 case CK_EditForceInternal
:
1211 edit_cmd_force_internal (current_panel
);
1214 case CK_EditExtensionsFile
:
1217 case CK_EditFileHighlightFile
:
1220 case CK_EditUserMenu
:
1221 edit_mc_menu_cmd ();
1223 case CK_LinkSymbolicEdit
:
1224 edit_symlink_cmd ();
1226 case CK_ExternalPanelize
:
1227 external_panelize_cmd ();
1229 case CK_ViewFiltered
:
1230 view_filtered_cmd (current_panel
);
1233 find_cmd (current_panel
);
1235 #ifdef ENABLE_VFS_SHELL
1236 case CK_ConnectShell
:
1240 #ifdef ENABLE_VFS_FTP
1245 #ifdef ENABLE_VFS_SFTP
1246 case CK_ConnectSftp
:
1251 panel_panelize_cd ();
1257 /* show the history of command line widget */
1258 send_message (cmdline
, NULL
, MSG_ACTION
, CK_History
, NULL
);
1261 if (sender
== WIDGET (the_menubar
))
1262 info_cmd (); /* menu */
1264 info_cmd_no_menu (); /* shortcut or buttonbar */
1266 #ifdef ENABLE_BACKGROUND
1271 case CK_OptionsLayout
:
1274 case CK_OptionsAppearance
:
1281 link_cmd (LINK_HARDLINK
);
1283 case CK_PanelListing
:
1286 #ifdef LISTMODE_EDITOR
1294 case CK_MenuLastSelected
:
1295 menu_last_selected_cmd ();
1298 mkdir_cmd (current_panel
);
1300 case CK_OptionsPanel
:
1301 panel_options_box ();
1304 case CK_SelectCodepage
:
1309 quick_cd_cmd (current_panel
);
1312 hotlist_cmd (current_panel
);
1314 case CK_PanelQuickView
:
1315 if (sender
== WIDGET (the_menubar
))
1316 quick_view_cmd (); /* menu */
1318 quick_cmd_no_menu (); /* shortcut or buttonabr */
1326 case CK_LinkSymbolicRelative
:
1327 link_cmd (LINK_SYMLINK_RELATIVE
);
1330 rename_cmd (current_panel
);
1337 vfs_list (current_panel
);
1345 case CK_SelectInvert
:
1347 res
= send_message (current_panel
, filemanager
, MSG_ACTION
, command
, NULL
);
1353 smart_dirsize_cmd (current_panel
);
1358 case CK_ExtendedKeyMap
:
1359 WIDGET (filemanager
)->ext_mode
= TRUE
;
1362 mc_event_raise (MCEVENT_GROUP_CORE
, "suspend", NULL
);
1367 case CK_LinkSymbolic
:
1368 link_cmd (LINK_SYMLINK_ABSOLUTE
);
1371 toggle_show_hidden ();
1373 case CK_SplitVertHoriz
:
1374 toggle_panels_split ();
1377 panels_split_equal ();
1380 panels_split_more ();
1383 panels_split_less ();
1391 #ifdef ENABLE_VFS_UNDELFS
1397 user_file_menu_cmd ();
1400 view_cmd (current_panel
);
1403 view_file_cmd (current_panel
);
1405 case CK_EditorViewerHistory
:
1406 show_editor_viewer_history ();
1409 /* don't close panels due to SIGINT */
1412 res
= MSG_NOT_HANDLED
;
1418 /* --------------------------------------------------------------------------------------------- */
1421 * Whether the command-line should not respond to key events.
1423 * This is TRUE if a QuickView or TreeView have the focus, as they're going
1424 * to consume some keys and there's no sense in passing to the command-line
1425 * just the leftovers.
1428 is_cmdline_mute (void)
1430 /* When one of panels is other than view_listing,
1431 current_panel points to view_listing panel all time independently of
1432 it's activity. Thus, we can't use get_current_type() here.
1433 current_panel should point to actually current active panel
1434 independently of it's type. */
1435 return (!current_panel
->active
1436 && (get_other_type () == view_quick
|| get_other_type () == view_tree
));
1439 /* --------------------------------------------------------------------------------------------- */
1442 * Handles the Enter key on the command-line.
1444 * Returns TRUE if non-whitespace was indeed processed.
1447 handle_cmdline_enter (void)
1451 for (s
= input_get_ctext (cmdline
); *s
!= '\0' && whitespace (*s
); s
++)
1456 send_message (cmdline
, NULL
, MSG_KEY
, '\n', NULL
);
1460 input_insert (cmdline
, "", FALSE
);
1466 /* --------------------------------------------------------------------------------------------- */
1469 midnight_callback (Widget
* w
, Widget
* sender
, widget_msg_t msg
, int parm
, void *data
)
1482 group_default_callback (w
, NULL
, MSG_DRAW
, 0, NULL
);
1483 /* We handle the special case of the output lines */
1484 if (mc_global
.tty
.console_flag
!= '\0' && output_lines
!= 0)
1486 unsigned char end_line
;
1488 end_line
= LINES
- (mc_global
.keybar_visible
? 1 : 0) - 1;
1489 show_console_contents (output_start_y
, end_line
- output_lines
, end_line
);
1494 widget_adjust_position (w
->pos_flags
, &w
->rect
);
1496 menubar_arrange (the_menubar
);
1500 /* We only need the first idle event to show user menu after start */
1501 widget_idle (w
, FALSE
);
1503 if (boot_current_is_left
)
1504 widget_select (get_panel_widget (0));
1506 widget_select (get_panel_widget (1));
1509 midnight_execute_cmd (NULL
, CK_UserMenu
);
1515 command
= widget_lookup_key (w
, parm
);
1516 if (command
!= CK_IgnoreKey
)
1517 return midnight_execute_cmd (NULL
, command
);
1520 /* FIXME: should handle all menu shortcuts before this point */
1521 if (widget_get_state (WIDGET (the_menubar
), WST_FOCUSED
))
1522 return MSG_NOT_HANDLED
;
1524 if (parm
== '\n' && !is_cmdline_mute ())
1526 if (handle_cmdline_enter ())
1528 /* Else: the panel will handle it. */
1531 if ((!mc_global
.tty
.alternate_plus_minus
1532 || !(mc_global
.tty
.console_flag
!= '\0' || mc_global
.tty
.xterm_flag
)) && !quote
1533 && !current_panel
->quick_search
.active
)
1535 if (!only_leading_plus_minus
)
1537 /* Special treatment, since the input line will eat them */
1539 return send_message (current_panel
, filemanager
, MSG_ACTION
, CK_Select
, NULL
);
1541 if (parm
== '\\' || parm
== '-')
1542 return send_message (current_panel
, filemanager
, MSG_ACTION
, CK_Unselect
, NULL
);
1545 return send_message (current_panel
, filemanager
, MSG_ACTION
, CK_SelectInvert
,
1548 else if (!command_prompt
|| input_is_empty (cmdline
))
1550 /* Special treatment '+', '-', '\', '*' only when this is
1551 * first char on input line
1554 return send_message (current_panel
, filemanager
, MSG_ACTION
, CK_Select
, NULL
);
1556 if (parm
== '\\' || parm
== '-')
1557 return send_message (current_panel
, filemanager
, MSG_ACTION
, CK_Unselect
, NULL
);
1560 return send_message (current_panel
, filemanager
, MSG_ACTION
, CK_SelectInvert
,
1564 return MSG_NOT_HANDLED
;
1566 case MSG_HOTKEY_HANDLED
:
1567 if ((get_current_type () == view_listing
) && current_panel
->quick_search
.active
)
1569 current_panel
->dirty
= TRUE
; /* FIXME: unneeded? */
1570 send_message (current_panel
, NULL
, MSG_ACTION
, CK_SearchStop
, NULL
);
1574 case MSG_UNHANDLED_KEY
:
1576 cb_ret_t v
= MSG_NOT_HANDLED
;
1578 command
= widget_lookup_key (w
, parm
);
1579 if (command
!= CK_IgnoreKey
)
1580 v
= midnight_execute_cmd (NULL
, command
);
1582 if (v
== MSG_NOT_HANDLED
&& command_prompt
&& !is_cmdline_mute ())
1583 v
= send_message (cmdline
, NULL
, MSG_KEY
, parm
, NULL
);
1589 if (!widget_get_state (WIDGET (the_menubar
), WST_FOCUSED
))
1590 update_dirty_panels ();
1594 /* Handle shortcuts, menu, and buttonbar. */
1595 return midnight_execute_cmd (sender
, parm
);
1602 return dlg_default_callback (w
, sender
, msg
, parm
, data
);
1606 /* --------------------------------------------------------------------------------------------- */
1607 /*** public functions ****************************************************************************/
1608 /* --------------------------------------------------------------------------------------------- */
1613 menu_set_name (left_menu
, panels_layout
.horizontal_split
? _("&Above") : _("&Left"));
1614 menu_set_name (right_menu
, panels_layout
.horizontal_split
? _("&Below") : _("&Right"));
1615 menubar_arrange (the_menubar
);
1616 widget_set_visibility (WIDGET (the_menubar
), menubar_visible
);
1619 /* --------------------------------------------------------------------------------------------- */
1622 midnight_set_buttonbar (WButtonBar
* b
)
1624 Widget
*w
= WIDGET (filemanager
);
1626 buttonbar_set_label (b
, 1, Q_ ("ButtonBar|Help"), w
->keymap
, NULL
);
1627 buttonbar_set_label (b
, 2, Q_ ("ButtonBar|Menu"), w
->keymap
, NULL
);
1628 buttonbar_set_label (b
, 3, Q_ ("ButtonBar|View"), w
->keymap
, NULL
);
1629 buttonbar_set_label (b
, 4, Q_ ("ButtonBar|Edit"), w
->keymap
, NULL
);
1630 buttonbar_set_label (b
, 5, Q_ ("ButtonBar|Copy"), w
->keymap
, NULL
);
1631 buttonbar_set_label (b
, 6, Q_ ("ButtonBar|RenMov"), w
->keymap
, NULL
);
1632 buttonbar_set_label (b
, 7, Q_ ("ButtonBar|Mkdir"), w
->keymap
, NULL
);
1633 buttonbar_set_label (b
, 8, Q_ ("ButtonBar|Delete"), w
->keymap
, NULL
);
1634 buttonbar_set_label (b
, 9, Q_ ("ButtonBar|PullDn"), w
->keymap
, NULL
);
1635 buttonbar_set_label (b
, 10, Q_ ("ButtonBar|Quit"), w
->keymap
, NULL
);
1638 /* --------------------------------------------------------------------------------------------- */
1640 * Return a random hint. If force is TRUE, ignore the timeout.
1644 get_random_hint (gboolean force
)
1646 static const gint64 update_period
= 60 * G_USEC_PER_SEC
;
1647 static gint64 tv
= 0;
1649 char *data
, *result
, *eop
;
1653 /* Do not change hints more often than one minute */
1654 if (!force
&& !mc_time_elapsed (&tv
, update_period
))
1655 return g_strdup ("");
1657 data
= load_mc_home_file (mc_global
.share_data_dir
, MC_HINT
, NULL
, &len
);
1661 /* get a random entry */
1662 srand ((unsigned int) (tv
/ G_USEC_PER_SEC
));
1663 start
= ((size_t) rand ()) % (len
- 1);
1665 /* Search the start of paragraph */
1666 for (; start
!= 0; start
--)
1667 if (data
[start
] == '\n' && data
[start
+ 1] == '\n')
1673 /* Search the end of paragraph */
1674 for (eop
= data
+ start
; *eop
!= '\0'; eop
++)
1676 if (*eop
== '\n' && *(eop
+ 1) == '\n')
1685 /* hint files are stored in utf-8 */
1686 /* try convert hint file from utf-8 to terminal encoding */
1687 conv
= str_crt_conv_from ("UTF-8");
1688 if (conv
== INVALID_CONV
)
1689 result
= g_strndup (data
+ start
, len
- start
);
1695 buffer
= g_string_sized_new (len
- start
);
1696 nok
= (str_convert (conv
, data
+ start
, buffer
) == ESTR_FAILURE
);
1697 result
= g_string_free (buffer
, nok
);
1698 str_close_conv (conv
);
1706 /* --------------------------------------------------------------------------------------------- */
1708 * Load new hint and display it.
1709 * IF force is not 0, ignore the timeout.
1713 load_hint (gboolean force
)
1717 if (WIDGET (the_hint
)->owner
== NULL
)
1720 if (!mc_global
.message_visible
)
1722 label_set_text (the_hint
, NULL
);
1726 hint
= get_random_hint (force
);
1736 char text
[BUF_SMALL
];
1738 g_snprintf (text
, sizeof (text
), _("GNU Midnight Commander %s\n"), mc_global
.mc_version
);
1743 /* --------------------------------------------------------------------------------------------- */
1745 * Change current panel in the file manager.
1747 * @return current_panel
1753 input_complete_free (cmdline
);
1754 group_select_next_widget (GROUP (filemanager
));
1755 return current_panel
;
1758 /* --------------------------------------------------------------------------------------------- */
1760 /** Save current stat of directories to avoid reloading the panels
1761 * when no modifications have taken place
1764 save_cwds_stat (void)
1766 if (panels_options
.fast_reload
)
1768 mc_stat (current_panel
->cwd_vpath
, &(current_panel
->dir_stat
));
1769 if (get_other_type () == view_listing
)
1770 mc_stat (other_panel
->cwd_vpath
, &(other_panel
->dir_stat
));
1774 /* --------------------------------------------------------------------------------------------- */
1777 quiet_quit_cmd (void)
1779 print_last_revert
= TRUE
;
1780 return quit_cmd_internal (1);
1783 /* --------------------------------------------------------------------------------------------- */
1785 /** Run the main dialog that occupies the whole screen */
1791 #ifdef USE_INTERNAL_EDIT
1795 filemanager
= dlg_create (FALSE
, 0, 0, 1, 1, WPOS_FULLSCREEN
, FALSE
, dialog_colors
,
1796 midnight_callback
, NULL
, "[main]", NULL
);
1798 /* Check if we were invoked as an editor or file viewer */
1799 if (mc_global
.mc_run_mode
!= MC_RUN_FULL
)
1802 ret
= mc_maybe_editor_or_viewer ();
1806 /* We only need the first idle event to show user menu after start */
1807 widget_idle (WIDGET (filemanager
), TRUE
);
1810 mc_filehighlight
= mc_fhl_new (TRUE
);
1812 create_file_manager ();
1813 (void) dlg_run (filemanager
);
1815 mc_fhl_free (&mc_filehighlight
);
1819 /* widget_destroy destroys even current_panel->cwd_vpath, so we have to save a copy :) */
1820 if (mc_args__last_wd_file
!= NULL
&& vfs_current_is_local ())
1821 last_wd_string
= g_strdup (vfs_path_as_str (current_panel
->cwd_vpath
));
1823 /* don't handle VFS timestamps for dirs opened in panels */
1824 mc_event_destroy (MCEVENT_GROUP_CORE
, "vfs_timestamp");
1828 mc_global
.midnight_shutdown
= TRUE
;
1829 dialog_switch_shutdown ();
1831 widget_destroy (WIDGET (filemanager
));
1832 current_panel
= NULL
;
1834 #ifdef USE_INTERNAL_EDIT
1838 if ((quit
& SUBSHELL_EXIT
) == 0)
1839 tty_clear_screen ();
1844 /* --------------------------------------------------------------------------------------------- */