summaryrefslogtreecommitdiffstats
path: root/lib/mcconfig
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:11:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:11:49 +0000
commit1b88cd5ee8510e90e69f885bfd730ce57621781c (patch)
treeb6b33bd695258f68c68824029c279d660ee4b85e /lib/mcconfig
parentAdding upstream version 3:4.8.30. (diff)
downloadmc-1b88cd5ee8510e90e69f885bfd730ce57621781c.tar.xz
mc-1b88cd5ee8510e90e69f885bfd730ce57621781c.zip
Adding upstream version 3:4.8.31.upstream/3%4.8.31upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--lib/mcconfig.h2
-rw-r--r--lib/mcconfig/Makefile.in2
-rw-r--r--lib/mcconfig/common.c2
-rw-r--r--lib/mcconfig/get.c2
-rw-r--r--lib/mcconfig/history.c38
-rw-r--r--lib/mcconfig/paths.c4
-rw-r--r--lib/mcconfig/set.c2
7 files changed, 40 insertions, 12 deletions
diff --git a/lib/mcconfig.h b/lib/mcconfig.h
index 0c3ab3b..abc28ef 100644
--- a/lib/mcconfig.h
+++ b/lib/mcconfig.h
@@ -105,6 +105,8 @@ vfs_path_t *mc_config_get_full_vpath (const char *config_name);
/* read history to the mc_config, but don't save config to file */
GList *mc_config_history_get (const char *name);
+/* read recent item from the history */
+char *mc_config_history_get_recent_item (const char *name);
/* load history from the mc_config */
GList *mc_config_history_load (mc_config_t * cfg, const char *name);
/* save history to the mc_config, but don't save config to file */
diff --git a/lib/mcconfig/Makefile.in b/lib/mcconfig/Makefile.in
index ae9c856..fd5aeda 100644
--- a/lib/mcconfig/Makefile.in
+++ b/lib/mcconfig/Makefile.in
@@ -134,7 +134,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
$(top_srcdir)/m4.include/vfs/mc-vfs-sfs.m4 \
$(top_srcdir)/m4.include/vfs/mc-vfs-ftp.m4 \
$(top_srcdir)/m4.include/vfs/mc-vfs-sftp.m4 \
- $(top_srcdir)/m4.include/vfs/mc-vfs-fish.m4 \
+ $(top_srcdir)/m4.include/vfs/mc-vfs-shell.m4 \
$(top_srcdir)/m4.include/vfs/mc-vfs-undelfs.m4 \
$(top_srcdir)/m4.include/vfs/mc-vfs-tarfs.m4 \
$(top_srcdir)/m4.include/vfs/mc-vfs-cpiofs.m4 \
diff --git a/lib/mcconfig/common.c b/lib/mcconfig/common.c
index 75979be..4891a39 100644
--- a/lib/mcconfig/common.c
+++ b/lib/mcconfig/common.c
@@ -1,7 +1,7 @@
/*
Configure module for the Midnight Commander
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
This file is part of the Midnight Commander.
diff --git a/lib/mcconfig/get.c b/lib/mcconfig/get.c
index f8ecfb1..4793b61 100644
--- a/lib/mcconfig/get.c
+++ b/lib/mcconfig/get.c
@@ -1,7 +1,7 @@
/*
Configure module for the Midnight Commander
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
This file is part of the Midnight Commander.
diff --git a/lib/mcconfig/history.c b/lib/mcconfig/history.c
index bfbdf0a..57249c4 100644
--- a/lib/mcconfig/history.c
+++ b/lib/mcconfig/history.c
@@ -1,7 +1,7 @@
/*
- Widgets for the Midnight Commander
+ Configure module for the Midnight Commander
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
Authors:
@@ -10,7 +10,7 @@
Jakub Jelinek, 1995
Andrej Borsenkow, 1996
Norbert Warmuth, 1997
- Andrew Borodin <aborodin@vmail.ru>, 2009-2019
+ Andrew Borodin <aborodin@vmail.ru>, 2009-2023
This file is part of the Midnight Commander.
@@ -65,7 +65,7 @@ int num_history_items_recorded = 60;
/* --------------------------------------------------------------------------------------------- */
/**
- * Load the history from the ${XDG_CACHE_HOME}/mc/history file.
+ * Load the history from the ${XDG_DATA_HOME}/mc/history file.
* It is called with the widgets history name and returns the GList list.
*/
@@ -95,6 +95,33 @@ mc_config_history_get (const char *name)
/* --------------------------------------------------------------------------------------------- */
/**
+ * Get the recent item of a history from the ${XDG_DATA_HOME}/mc/history file.
+ *
+ * TODO: get rid of load the entire history to get the only top item.
+ */
+
+char *
+mc_config_history_get_recent_item (const char *name)
+{
+ GList *history;
+ char *item = NULL;
+
+ history = mc_config_history_get (name);
+ if (history != NULL)
+ {
+ /* FIXME: can history->data be NULL? */
+ item = (char *) history->data;
+ history->data = NULL;
+ history = g_list_first (history);
+ g_list_free_full (history, g_free);
+ }
+
+ return item;
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/**
* Load history from the mc_config
*/
GList *
@@ -177,8 +204,7 @@ mc_config_history_save (mc_config_t * cfg, const char *name, GList * h)
for (i = 0; (i < num_history_items_recorded - 1) && (h->prev != NULL); i++)
h = g_list_previous (h);
- if (name != NULL)
- mc_config_del_group (cfg, name);
+ mc_config_del_group (cfg, name);
/* create charset conversion handler to convert strings
from system codepage to UTF-8 */
diff --git a/lib/mcconfig/paths.c b/lib/mcconfig/paths.c
index 46ec14d..fbb71c3 100644
--- a/lib/mcconfig/paths.c
+++ b/lib/mcconfig/paths.c
@@ -1,7 +1,7 @@
/*
paths to configuration files
- Copyright (C) 2010-2023
+ Copyright (C) 2010-2024
Free Software Foundation, Inc.
Written by:
@@ -74,7 +74,7 @@ static const struct
/* data */
{ &mc_data_str, MC_SKINS_DIR },
- { &mc_data_str, FISH_PREFIX },
+ { &mc_data_str, VFS_SHELL_PREFIX },
{ &mc_data_str, MC_ASHRC_FILE },
{ &mc_data_str, MC_BASHRC_FILE },
{ &mc_data_str, MC_INPUTRC_FILE },
diff --git a/lib/mcconfig/set.c b/lib/mcconfig/set.c
index 961435f..ce6d887 100644
--- a/lib/mcconfig/set.c
+++ b/lib/mcconfig/set.c
@@ -1,7 +1,7 @@
/*
Configure module for the Midnight Commander
- Copyright (C) 1994-2023
+ Copyright (C) 1994-2024
Free Software Foundation, Inc.
This file is part of the Midnight Commander.