Merge branch '2783_panel_dir_fix'

* 2783_panel_dir_fix:
  Ticket #2783: when right panel is active, panel paths are swapped at each mc start.
This commit is contained in:
Andrew Borodin 2012-05-04 18:19:58 +04:00
commit ae62e04274
2 changed files with 22 additions and 4 deletions

View File

@ -579,7 +579,10 @@ create_panels (void)
other_index = 1;
current_mode = startup_left_mode;
other_mode = startup_right_mode;
/* if mc_run_param0 is NULL, working directory will be used for the left panel */
current_dir = mc_run_param0;
/* mc_run_param1 is never NULL. It is setup from command line or from panels.ini
* (value of other_dir). mc_run_param1 will be used for the right panel */
other_dir = mc_run_param1;
}
else
@ -589,8 +592,21 @@ create_panels (void)
other_index = 0;
current_mode = startup_right_mode;
other_mode = startup_left_mode;
current_dir = mc_run_param1;
other_dir = mc_run_param0;
/* if mc_run_param0 is not NULL (it was setup from command line), it will be used
* for the left panel, working directory will be used for the right one;
* if mc_run_param0 is NULL, working directory will be used for the right (active) panel,
* mc_run_param1 will be used for the left one */
if (mc_run_param0 != NULL)
{
current_dir = NULL;
other_dir = mc_run_param0;
}
else
{
current_dir = NULL;
other_dir = mc_run_param1;
}
}
/* 1. Get current dir */
@ -609,7 +625,10 @@ create_panels (void)
/* 3. Create active panel */
if (current_dir == NULL)
{
current_dir = vfs_path_to_str (original_dir);
mc_chdir (original_dir);
}
else
{
vfs_path_t *vpath;

View File

@ -799,8 +799,7 @@ save_panel_types (void)
}
if (current_panel != NULL)
mc_config_set_string (mc_panels_config, "Dirs", "current_is_left",
get_current_index () == 0 ? "1" : "0");
mc_config_set_bool (mc_panels_config, "Dirs", "current_is_left", get_current_index () == 0);
if (mc_panels_config->ini_path == NULL)
mc_panels_config->ini_path = g_strdup (panels_profile_name);