(set_display_type): rename to create_panel.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2019-01-20 12:07:27 +03:00
parent 40b2681294
commit 615f29d7d5
7 changed files with 22 additions and 22 deletions

View File

@ -460,7 +460,7 @@ nice_cd (const char *text, const char *xtext, const char *help,
save_type = get_display_type (MENU_PANEL_IDX);
if (save_type != view_listing)
set_display_type (MENU_PANEL_IDX, view_listing);
create_panel (MENU_PANEL_IDX, view_listing);
cd_vpath = vfs_path_from_str_flags (cd_path, VPF_NO_CANON);
if (!do_panel_cd (MENU_PANEL, cd_vpath, cd_parse_command))
@ -468,7 +468,7 @@ nice_cd (const char *text, const char *xtext, const char *help,
message (D_ERROR, MSG_ERROR, _("Cannot chdir to \"%s\""), cd_path);
if (save_type != view_listing)
set_display_type (MENU_PANEL_IDX, save_type);
create_panel (MENU_PANEL_IDX, save_type);
}
vfs_path_free (cd_vpath);
}
@ -515,7 +515,7 @@ static void
switch_to_listing (int panel_index)
{
if (get_display_type (panel_index) != view_listing)
set_display_type (panel_index, view_listing);
create_panel (panel_index, view_listing);
}
/* --------------------------------------------------------------------------------------------- */
@ -1536,11 +1536,11 @@ void
info_cmd_no_menu (void)
{
if (get_display_type (0) == view_info)
set_display_type (0, view_listing);
create_panel (0, view_listing);
else if (get_display_type (1) == view_info)
set_display_type (1, view_listing);
create_panel (1, view_listing);
else
set_display_type (current_panel == left_panel ? 1 : 0, view_info);
create_panel (current_panel == left_panel ? 1 : 0, view_info);
}
/* --------------------------------------------------------------------------------------------- */
@ -1549,11 +1549,11 @@ void
quick_cmd_no_menu (void)
{
if (get_display_type (0) == view_quick)
set_display_type (0, view_listing);
create_panel (0, view_listing);
else if (get_display_type (1) == view_quick)
set_display_type (1, view_listing);
create_panel (1, view_listing);
else
set_display_type (current_panel == left_panel ? 1 : 0, view_quick);
create_panel (current_panel == left_panel ? 1 : 0, view_quick);
}
/* --------------------------------------------------------------------------------------------- */
@ -1601,7 +1601,7 @@ setup_listing_format_cmd (void)
void
panel_tree_cmd (void)
{
set_display_type (MENU_PANEL_IDX, view_tree);
create_panel (MENU_PANEL_IDX, view_tree);
}
/* --------------------------------------------------------------------------------------------- */
@ -1609,7 +1609,7 @@ panel_tree_cmd (void)
void
info_cmd (void)
{
set_display_type (MENU_PANEL_IDX, view_info);
create_panel (MENU_PANEL_IDX, view_info);
}
/* --------------------------------------------------------------------------------------------- */
@ -1619,7 +1619,7 @@ quick_view_cmd (void)
{
if (PANEL (get_panel_widget (MENU_PANEL_IDX)) == current_panel)
change_panel ();
set_display_type (MENU_PANEL_IDX, view_quick);
create_panel (MENU_PANEL_IDX, view_quick);
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -106,7 +106,7 @@ int ok_to_refresh = 1;
/*** file scope macro definitions ****************************************************************/
/* The maximum number of views managed by the set_display_type routine */
/* The maximum number of views managed by the create_panel routine */
/* Must be at least two (for current and other). Please note that until */
/* Janne gets around this, we will only manage two of them :-) */
#define MAX_VIEWS 2
@ -971,7 +971,7 @@ get_nth_panel_name (int num)
/* since a lot of routines depend on the current_panel variable */
void
set_display_type (int num, panel_view_mode_t type)
create_panel (int num, panel_view_mode_t type)
{
int x = 0, y = 0, cols = 0, lines = 0;
unsigned int the_other = 0; /* Index to the other panel */

View File

@ -62,7 +62,7 @@ void panels_split_more (void);
void panels_split_less (void);
void destroy_panels (void);
void setup_cmdline (void);
void set_display_type (int num, panel_view_mode_t type);
void create_panel (int num, panel_view_mode_t type);
void swap_panels (void);
panel_view_mode_t get_display_type (int idx);
panel_view_mode_t get_current_type (void);

View File

@ -661,7 +661,7 @@ create_panels (void)
mc_chdir (vpath);
vfs_path_free (vpath);
}
set_display_type (other_index, other_mode);
create_panel (other_index, other_mode);
/* 3. Create active panel */
if (current_dir == NULL)
@ -677,7 +677,7 @@ create_panels (void)
mc_chdir (vpath);
vfs_path_free (vpath);
}
set_display_type (current_index, current_mode);
create_panel (current_index, current_mode);
if (startup_left_mode == view_listing)
current_panel = left_panel;

View File

@ -2877,7 +2877,7 @@ chdir_other_panel (WPanel * panel)
char *sel_entry = NULL;
if (get_other_type () != view_listing)
set_display_type (get_other_index (), view_listing);
create_panel (get_other_index (), view_listing);
if (S_ISDIR (entry->st.st_mode) || link_isdir (entry))
new_dir_vpath = vfs_path_append_new (panel->cwd_vpath, entry->fname, (char *) NULL);
@ -2910,7 +2910,7 @@ static void
panel_sync_other (const WPanel * panel)
{
if (get_other_type () != view_listing)
set_display_type (get_other_index (), view_listing);
create_panel (get_other_index (), view_listing);
do_panel_cd (other_panel, current_panel->cwd_vpath, cd_exact);

View File

@ -517,7 +517,7 @@ void
cd_panelize_cmd (void)
{
if (!SELECTED_IS_PANEL)
set_display_type (MENU_PANEL_IDX, view_listing);
create_panel (MENU_PANEL_IDX, view_listing);
do_panelize_cd (PANEL (get_panel_widget (MENU_PANEL_IDX)));
}

View File

@ -701,11 +701,11 @@ mcview_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *
* panel mode from qick view to another one (by pressing C-x q), the following
* occurs:
* view hook is deleted from select_file_hook list via following call chain:
* set_display_type (view_listing) -> widget_replace () ->
* create_panel (view_listing) -> widget_replace () ->
* send_message (MSG_DESTROY) -> mcview_callback (MSG_DESTROY) ->
* delete_hook (&select_file_hook);
* @view object is free'd:
* set_display_type (view_listing) -> g_free (old_widget);
* create_panel (view_listing) -> g_free (old_widget);
* but @view still is in idle_hook list and tried to be executed:
* frontend_dlg_run () -> execute_hooks (idle_hook).
* Thus here we have access to free'd @view object. To prevent this, remove view hook