Guest User

~/rpmbuild/SOURCES/mc-2panels.patch

a guest
Feb 5th, 2018
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.20 KB | None | 0 0
  1. --- ../mc-4.8.19.orig/src/setup.h   2017-03-05 01:51:39.000000000 +0800
  2. +++ src/setup.h 2018-02-05 18:24:54.884665367 +0800
  3. @@ -117,6 +117,9 @@
  4.  extern char *spell_language;
  5.  #endif
  6.  
  7. +/* Value of "current_dir" key in ini file */
  8. +extern char *saved_current_dir;
  9. +
  10.  /* Value of "other_dir" key in ini file */
  11.  extern char *saved_other_dir;
  12.  
  13. --- ../mc-4.8.19.orig/src/setup.c   2017-03-05 01:51:39.000000000 +0800
  14. +++ src/setup.c 2018-02-05 18:11:14.352771282 +0800
  15. @@ -192,6 +192,9 @@
  16.  char *spell_language = NULL;
  17.  #endif
  18.  
  19. +/* Value of "current_dir" key in ini file */
  20. +char *saved_current_dir = NULL;
  21. +
  22.  /* Value of "other_dir" key in ini file */
  23.  char *saved_other_dir = NULL;
  24.  
  25. @@ -1005,8 +1008,12 @@
  26.      {
  27.          char *dirs;
  28.  
  29. +        dirs = get_panel_dir_for (current_panel);
  30. +        mc_config_set_string (mc_global.panels_config, "Dirs", "current_dir", dirs);
  31. +
  32.          dirs = get_panel_dir_for (other_panel);
  33.          mc_config_set_string (mc_global.panels_config, "Dirs", "other_dir", dirs);
  34. +
  35.          g_free (dirs);
  36.      }
  37.  
  38. --- ../mc-4.8.19.orig/src/main.c    2017-03-05 01:51:39.000000000 +0800
  39. +++ src/main.c  2018-02-05 18:11:14.352771282 +0800
  40. @@ -291,6 +291,7 @@
  41.      {
  42.          vfs_shut ();
  43.          done_setup ();
  44. +        g_free (saved_current_dir);
  45.          g_free (saved_other_dir);
  46.          mc_event_deinit (NULL);
  47.          goto startup_exit_falure;
  48. @@ -305,6 +306,13 @@
  49.          char *buffer;
  50.          vfs_path_t *vpath;
  51.  
  52. +        buffer = mc_config_get_string (mc_global.panels_config, "Dirs", "current_dir", ".");
  53. +        vpath = vfs_path_from_str (buffer);
  54. +        if (vfs_file_is_local (vpath))
  55. +            saved_current_dir = buffer;
  56. +        else
  57. +            g_free (buffer);
  58. +
  59.          buffer = mc_config_get_string (mc_global.panels_config, "Dirs", "other_dir", ".");
  60.          vpath = vfs_path_from_str (buffer);
  61.          if (vfs_file_is_local (vpath))
  62. @@ -485,6 +493,7 @@
  63.          g_list_free_full ((GList *) mc_run_param0, (GDestroyNotify) mcedit_arg_free);
  64.  
  65.      g_free (mc_run_param1);
  66. +    g_free (saved_current_dir);
  67.      g_free (saved_other_dir);
  68.  
  69.      mc_config_deinit_config_paths ();
  70. --- ../mc-4.8.19.orig/src/filemanager/midnight.c    2017-03-05 01:51:38.000000000 +0800
  71. +++ src/filemanager/midnight.c  2018-02-05 18:11:14.352771282 +0800
  72. @@ -601,7 +601,8 @@
  73.          if (mc_run_param0 == NULL && mc_run_param1 == NULL)
  74.          {
  75.              /* no arguments */
  76. -            current_dir = NULL; /* assume current dir */
  77. +            //current_dir = NULL; /* assume current dir */
  78. +            current_dir = saved_current_dir;    /* from ini */
  79.              other_dir = saved_other_dir;        /* from ini */
  80.          }
  81.          else if (mc_run_param0 != NULL && mc_run_param1 != NULL)
  82. @@ -628,7 +629,8 @@
  83.          if (mc_run_param0 == NULL && mc_run_param1 == NULL)
  84.          {
  85.              /* no arguments */
  86. -            current_dir = NULL; /* assume current dir */
  87. +            //current_dir = NULL; /* assume current dir */
  88. +            current_dir = saved_current_dir;    /* from ini */
  89.              other_dir = saved_other_dir;        /* from ini */
  90.          }
  91.          else if (mc_run_param0 != NULL && mc_run_param1 != NULL)
Add Comment
Please, Sign In to add comment