Commit Graph

108 Commits

Author SHA1 Message Date
Andrew Borodin 6718b3ec26 Indentation using GNU indent-2.2.13.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-06-02 12:49:13 +03:00
Andrew Borodin fe42478b97 Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2024-01-01 09:46:17 +03:00
Andrew Borodin 7459861f58 (mc_config_history_save): remove check because condition is always true here.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:15 +03:00
Andrew Borodin a74d638155 (mc_config_history_get_recent_item): new API.
* (edit_search_cmd): use mc_config_history_get_recent_item().
  * (mcview_continue_search_cmd): likewise.

mc_config_history_get_recent_item() is not implemented optimally yet.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:15 +03:00
Andrew Borodin 018687b12f Fix comments of history and panels.ini files location.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:15 +03:00
Andrew Borodin 6b274f7034 lib/mcconfig/history.c: fix comments.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-11-06 21:06:15 +03:00
Andrew Borodin 6ca4ab4b4e Rename FISH VFS to SHELL one. 2023-10-15 16:04:39 +03:00
Andrew Borodin 0a9ecdeb98 Remove #include <errno.h> from files where errno is unused. 2023-08-04 21:04:54 +03:00
Andrew Borodin 7257f794d2 Update template for .c files.
Add section for forward declarations of local functions. This section is
located before file scope variables because functions can be used in
strucutres (see find.c for example):

/*** forward declarations (file scope functions) *************************************************/

/* button callbacks */
static int start_stop (WButton * button, int action);
static int find_do_view_file (WButton * button, int action);
static int find_do_edit_file (WButton * button, int action);

/*** file scope variables ************************************************************************/

static struct
{
    ...
    bcback_fn callback;
} fbuts[] =
{
    ...
    { B_STOP, NORMAL_BUTTON, N_("S&uspend"), 0, 0, NULL, start_stop },
    ...
    { B_VIEW, NORMAL_BUTTON, N_("&View - F3"), 0, 0, NULL, find_do_view_file },
    { B_VIEW, NORMAL_BUTTON, N_("&Edit - F4"), 0, 0, NULL, find_do_edit_file }
};

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-03-19 20:34:24 +03:00
Andrew Borodin 57c61b7681 Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2023-01-28 21:38:05 +03:00
Andrew Borodin 3f882f50e0 Ticket #4413: mcedit: syntax definitions in user location don't work.
Fix location of all user's syntax related stuff. Now it is the
~/.local/share/mc/syntax/ directory.

Don't use the system configuration directory (/etc/mc) as a storage
of syntax definitions.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-12-18 14:20:36 +03:00
Andrew Borodin d9eeec9a5a Port mc.ext to INI format.
Ticket #2773: 'include' keyword (for command class def) have no effect
if it was defined before 'Include' keyword (for command def).

Ticket #3742: update comment in mc.ext.ini.

doc: remove mc.ext.ini format description from manual page.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-09-25 14:55:00 +03:00
Andrew Borodin cf660c7f9d (mc_config_has_param): use g_key_file_get_value()...
to check if a parameter exists.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-08-28 11:10:39 +03:00
Andrew Borodin 67ec86b570 Ticket #4141: allow compound (AND) conditions in mc.ext
...to disambiguate overloaded extensions

Initial commit:
  * rename macro for mc.ext file: MC_FILEBIND_FILE -> MC_EXT_FILE.
  * (ext_cmd): fix errorous usage of MC_LIB_EXT macro. Use MC_EXT_FILE
    instead.
  * (regex_command_for): likewise. Use already existing variable
    extension_file, remove variable filebind_filename.
  * MC_LIB_EXT: remove macro.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-08-28 11:10:39 +03:00
Andrew Borodin 4008d3b96c (mc_config_get_string): use mc_config_get_string_raw()
...to get rid of code duplcation.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-05 12:19:47 +03:00
Andrew Borodin 2c205c5928 Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:26 +03:00
Andrew Borodin 536fb676d8 (vfs_path_free): add 2nd parameter...
...to free or not to free the string representation
of vfs_path_t object.

It allows to get rid of string duplication in following cases:

vfs_path_t *vpath;
char *path;
...
vpath = vfs_path_from_str (...);
path = g_strdup (vfs_path_as_str (vpath));
vfs_path_free (vpath);

Now we can write:

vfs_path_t *vpath;
char *path;
...
vpath = vfs_path_from_str (...);
path = vfs_path_free (vpath, FALSE);

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:52:39 +03:00
Andrew Borodin 0c02118fad Define macros for bashrc, ashrc, and inputrc files.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:52:38 +03:00
Andrew Borodin 9ee52e77c3 Ticket #4179: code clean up before 4.8.27 release.
Update copyright years.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:30:42 +03:00
Andrew Borodin 76847e08fd Ticket #4203: support custom .zshrc.
Custom .zshrc file is  ~/.local/share/mc/.zshrc.

If ZDOTDIR environment variable is not set, set it to ~/.local/share/mc
if a .zshrc is found there. It is the only way to point zsh to an other
rc file than the default.

Thanks Sebastian Gniazdowski <sgniazdowski@gmail.com> for the original
patch.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-13 20:17:31 +03:00
Andrew Borodin 285eb5c186 Ticket #3682: drop automatic migration of configuration
...from ~/.mc to XDG-base.

Now MC ignores ~/.mc directory and uses XDG-based only.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-02-22 21:16:52 +03:00
Andrew Borodin 562889ce1e Rename macro MC_SKINS_SUBDIR to MC_SKINS_DIR.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-05-17 18:48:19 +03:00
Andrew Borodin 246bdd63b4 lib/mcconfig/paths.c: cosmetics.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-05-17 18:48:19 +03:00
Andrew Borodin b65a951ee4 Clean up files unused by mcedit anymore.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-05-17 18:48:19 +03:00
Andrew Borodin 81b1f47e01 Rename macros with editor-related file locations.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-05-17 18:48:19 +03:00
Andrew Borodin 31b37a1f79 Ticket #4050: code cleanup before 4.8.25 release.
Update copyright years.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-02-29 19:10:17 +03:00
Andrew Borodin 29110e5681 Move history operation routines from lib/widget/history.c to lib/mcconfig/history.c.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-09-01 19:41:12 +03:00
Andrew Borodin 0efb799db3 lib/mcconfig: fix coding style; apply source file template.
Unconstify some function arguments.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-09-01 19:41:12 +03:00
Andrew Borodin 1dd8a47987 Ticket #3955: code cleanup before 4.8.23 release.
Update copyright years.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-02-03 12:44:40 +03:00
Andrew Borodin ddd645526a Update copyright years. 2018-02-04 11:30:22 +03:00
Yury V. Zaytsev ab4fcb6d30 Revert "Ticket #3687: store the 'hotlist' file in data dir, not config dir."
This reverts commit 306b30ed30.
2017-02-24 21:32:01 +01:00
Andrew Borodin e9fd11bfcd Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 19:12:55 +03:00
Mooffie 306b30ed30 Ticket #3687: store the 'hotlist' file in data dir, not config dir.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:48:02 +03:00
Andrew Borodin 8002e52293 (mc_config_init_config_paths): minor optimization.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:37:50 +03:00
Andrew Borodin 496abc0e1f Rename mc_config_get_profile_root() to mc_get_profile_root()
...and move it out from lib/mcconfig.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:37:50 +03:00
Mooffie 239a8d0117 Ticket #3684: replace $MC_HOME with $MC_PROFILE_ROOT, a better "profile" mechanism.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-29 11:10:19 +03:00
Mooffie 61f4ef98b9 lib/mcconfig/paths.c: reduce scope of 'homedir' var.
To ensure that nobody uses the 'homedir' variable in the future without
initializing it first, we make it private to the function, thereby effectively
removing it.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:11:01 +03:00
Mooffie 92889819ea lib/mcconfig/paths.c: cleanup.
We can conclude, by reading their GLib source[1], by their documentation,
and by looking at how popular programs use them[2], that the functions
g_get_user_{config,cache,data}_dir() don't return a NULL or empty string.
So the handling of this case can go.

[1] https://git.gnome.org/browse/glib/tree/glib/gutils.c
[2] E.g., google "g_get_user_data_dir".

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:11:01 +03:00
Andrew Borodin 2151edaff2 Get rid of global variables mc_main_config and mc_panels_config.
Use mc_global.main_config and mc_global.panels_congig instead.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:19:02 +03:00
Andreas Mohr eef076cef6 cppcheck: Cleanup Passing NULL after the last typed argument warning
Cleanup Passing NULL after the last typed argument warning.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:19:02 +03:00
Andreas Mohr 97e370e396 lib/mcconfig/paths.c: cleanup -Wcast-qual warning.
Signed-off-by: Andreas Mohr <and@gmx.li>
2016-04-16 10:23:43 +03:00
Andrew Borodin 471ea781ca Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-01-01 11:48:10 +03:00
Andrew Borodin 4ce4c9b7dc Remove GLib-compatible code related to GLib < 2.26. 2016-01-01 11:48:06 +03:00
Alexander Kriegisch 09ed02ea85 Minor code changes.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2015-11-10 11:55:38 +03:00
Andrew Borodin b698b7e834 Ticket #3435: clang compiler fixes/cleanups.
Since O_* macros are used in lib/global.h, include <fcntl.h> there.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2015-05-03 19:43:49 +03:00
Andreas Mohr 8a2f9e253d Ticket #3430: introduce -Wundef check to catch macro typos.
Use always defined MC_HOMEDIR_XDG macro.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2015-05-03 19:43:48 +03:00
Andreas Mohr 7665a2a2e2 Ticket #3420: code cleanup before 3.4.15 release.
Ticket #3424: fix -Wdeclaration-after-statement compiler warnings.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2015-05-03 19:43:48 +03:00
Andrew Borodin 454479549c Update copyright years. 2015-02-26 09:12:08 +03:00
Andrew Borodin 6d82155270 Massive use of MC_PTR_FREE macro.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2014-09-02 15:32:36 +04:00
Slava Zanko 512ad7d962 Make working with GError in more right way (like with exceptions).
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2014-07-22 13:12:07 +04:00