Ticket #3699: patch01-setup.ch-main.c-midnight.c-auto-save-restore-panel.161007.diff
File patch01-setup.ch-main.c-midnight.c-auto-save-restore-panel.161007.diff, 4.3 KB (added by zaytsev, 8 years ago) |
---|
-
src/setup.h
old new extern char *spell_language; 119 119 120 120 /* Value of "other_dir" key in ini file */ 121 121 extern char *saved_other_dir; 122 extern char *saved_this_dir; 122 123 123 124 /* If set, then print to the given file the last directory we were at */ 124 125 extern char *last_wd_string; -
src/setup.c
old new char *spell_language = NULL; 194 194 195 195 /* Value of "other_dir" key in ini file */ 196 196 char *saved_other_dir = NULL; 197 char *saved_this_dir = NULL; 197 198 198 199 /* If set, then print to the given file the last directory we were at */ 199 200 char *last_wd_string = NULL; … … save_panel_types (void) 930 931 panel_save_setup (right_panel, right_panel->panel_name); 931 932 932 933 { 933 char *dirs;934 934 935 dirs = get_panel_dir_for (other_panel); 936 mc_config_set_string (mc_global.panels_config, "Dirs", "other_dir", dirs); 937 g_free (dirs); 935 WPanel *this_panel = PANEL(get_panel_widget(get_current_index())); 936 char *this_dir; 937 char *other_dir; 938 939 this_dir = get_panel_dir_for(this_panel); 940 mc_config_set_string (mc_global.panels_config, "Dirs", "this_dir", this_dir); 941 g_free (this_dir); 942 943 other_dir = get_panel_dir_for (other_panel); 944 mc_config_set_string (mc_global.panels_config, "Dirs", "other_dir", other_dir); 945 g_free (other_dir); 938 946 } 939 947 940 948 if (current_panel != NULL) -
src/main.c
old new main (int argc, char *argv[]) 282 282 /* Must be done after load_setup because depends on mc_global.vfs.cd_symlinks */ 283 283 vfs_setup_work_dir (); 284 284 285 /* Resolve th e other_dir panel option. Must be done after vfs_setup_work_dir */285 /* Resolve this_dir/other_dir panel options. Must be done after vfs_setup_work_dir */ 286 286 { 287 287 char *buffer; 288 288 vfs_path_t *vpath; 289 289 290 buffer = mc_config_get_string (mc_global.panels_config, "Dirs", "this_dir", "."); 291 vpath = vfs_path_from_str (buffer); 292 if (vfs_file_is_local (vpath)) 293 saved_this_dir = buffer; 294 else 295 g_free (buffer); 296 vfs_path_free (vpath); 297 290 298 buffer = mc_config_get_string (mc_global.panels_config, "Dirs", "other_dir", "."); 291 299 vpath = vfs_path_from_str (buffer); 292 300 if (vfs_file_is_local (vpath)) … … main (int argc, char *argv[]) 305 313 { 306 314 vfs_shut (); 307 315 done_setup (); 316 g_free (saved_this_dir); 308 317 g_free (saved_other_dir); 309 318 mc_event_deinit (NULL); 310 319 goto startup_exit_falure; … … main (int argc, char *argv[]) 481 490 g_list_free_full ((GList *) mc_run_param0, (GDestroyNotify) mcedit_arg_free); 482 491 483 492 g_free (mc_run_param1); 493 g_free (saved_this_dir); 484 494 g_free (saved_other_dir); 485 495 486 496 mc_config_deinit_config_paths (); -
src/filemanager/midnight.c
old new create_panels (void) (this hunk was shorter than expected) 598 598 current_mode = startup_left_mode; 599 599 other_mode = startup_right_mode; 600 600 601 601 if (mc_run_param0 == NULL && mc_run_param1 == NULL) 602 602 { 603 603 /* no arguments */ 604 current_dir = NULL; /* assume current dir */ 604 if (panels_options.auto_save_setup) { /* check if we should restore active panel */ 605 current_dir = saved_this_dir; 606 } else { 607 current_dir = NULL; /* assume current dir */ 608 } 605 609 other_dir = saved_other_dir; /* from ini */ 606 610 } 607 611 else if (mc_run_param0 != NULL && mc_run_param1 != NULL) … … create_panels (void) 628 633 if (mc_run_param0 == NULL && mc_run_param1 == NULL) 629 634 { 630 635 /* no arguments */ 631 current_dir = NULL; /* assume current dir */ 636 if (panels_options.auto_save_setup) { /* check if we should restore active panel */ 637 current_dir = saved_this_dir; 638 } else { 639 current_dir = NULL; /* assume current dir */ 640 } 632 641 other_dir = saved_other_dir; /* from ini */ 633 642 } 634 643 else if (mc_run_param0 != NULL && mc_run_param1 != NULL)