From f899f62a866eeee3b62e943ee2d83d5a2e8e531d Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sun, 22 Apr 2012 18:27:40 +0400 Subject: [PATCH] Ticket #2313: CK_History removes CK_HistoryNext entries Steps to reproduce: 1. traverse through some directories, 2. press alt-y multiple times, 3. press alt-u multiple times, 4. press alt-y again a few times, 5. press alt-shift-h (notice no dirs to forward to), press esc, 6. press alt-u - nothing happens. Initial step: (directory_history_add): make static and use vfs_path_t as argument. Signed-off-by: Andrew Borodin --- src/filemanager/panel.c | 47 ++++++++++++----------------------------- src/filemanager/panel.h | 2 -- 2 files changed, 14 insertions(+), 35 deletions(-) diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c index 21432855e..39f0c09ac 100644 --- a/src/filemanager/panel.c +++ b/src/filemanager/panel.c @@ -1382,6 +1382,17 @@ panel_save_name (WPanel * panel) /* --------------------------------------------------------------------------------------------- */ +static void +directory_history_add (struct WPanel *panel, const vfs_path_t * vpath) +{ + char *tmp; + + tmp = vfs_path_to_str_flags (vpath, 0, VPF_STRIP_PASSWORD); + panel->dir_history = list_append_unique (panel->dir_history, tmp); +} + +/* --------------------------------------------------------------------------------------------- */ + /* "history_load" event handler */ static gboolean panel_load_history (const gchar * event_group_name, const gchar * event_name, @@ -1395,16 +1406,12 @@ panel_load_history (const gchar * event_group_name, const gchar * event_name, if (ev->receiver == NULL || ev->receiver == (Widget *) p) { - char *tmp_path; - - tmp_path = vfs_path_to_str (p->cwd_vpath); if (ev->cfg != NULL) p->dir_history = history_load (ev->cfg, p->hist_name); else p->dir_history = history_get (p->hist_name); - directory_history_add (p, tmp_path); - g_free (tmp_path); + directory_history_add (p, p->cwd_vpath); } return TRUE; @@ -3123,13 +3130,7 @@ directory_history_list (WPanel * panel) s_vpath = vfs_path_from_str (s); if (_do_panel_cd (panel, s_vpath, cd_exact)) - { - char *tmp_path; - - tmp_path = vfs_path_to_str (panel->cwd_vpath); - directory_history_add (panel, tmp_path); - g_free (tmp_path); - } + directory_history_add (panel, panel->cwd_vpath); else message (D_ERROR, MSG_ERROR, _("Cannot change directory")); vfs_path_free (s_vpath); @@ -4407,13 +4408,7 @@ do_panel_cd (struct WPanel *panel, const vfs_path_t * new_dir_vpath, enum cd_enu r = _do_panel_cd (panel, new_dir_vpath, cd_type); if (r) - { - char *tmp_path; - - tmp_path = vfs_path_to_str (panel->cwd_vpath); - directory_history_add (panel, tmp_path); - g_free (tmp_path); - } + directory_history_add (panel, panel->cwd_vpath); return r; } @@ -4571,20 +4566,6 @@ update_panels (panel_update_flags_t flags, const char *current_file) /* --------------------------------------------------------------------------------------------- */ -void -directory_history_add (struct WPanel *panel, const char *dir) -{ - vfs_path_t *vpath; - char *tmp; - - vpath = vfs_path_from_str (dir); - tmp = vfs_path_to_str_flags (vpath, 0, VPF_STRIP_PASSWORD); - vfs_path_free (vpath); - panel->dir_history = list_append_unique (panel->dir_history, tmp); -} - -/* --------------------------------------------------------------------------------------------- */ - gsize panel_get_num_of_sortable_fields (void) { diff --git a/src/filemanager/panel.h b/src/filemanager/panel.h index 43cb9c777..cf980f1c2 100644 --- a/src/filemanager/panel.h +++ b/src/filemanager/panel.h @@ -163,8 +163,6 @@ void do_file_mark (WPanel * panel, int idx, int val); gboolean do_panel_cd (struct WPanel *panel, const vfs_path_t * new_dir_vpath, enum cd_enum cd_type); -void directory_history_add (struct WPanel *panel, const char *dir); - vfs_path_t *remove_encoding_from_path (const vfs_path_t * vpath); gsize panel_get_num_of_sortable_fields (void);