diff --git a/acinclude.m4 b/acinclude.m4 index 4ee84340a..762d95081 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -10,6 +10,7 @@ m4_include([m4.include/mountlist.m4]) m4_include([m4.include/mc-get-fs-info.m4]) m4_include([m4.include/mc-use-termcap.m4]) m4_include([m4.include/mc-with-screen.m4]) +m4_include([m4.include/mc-background.m4]) m4_include([m4.include/ac-glib.m4]) m4_include([m4.include/mc-vfs.m4]) m4_include([m4.include/mc-version.m4]) diff --git a/configure.ac b/configure.ac index b0b3c40a9..6e2e004b9 100644 --- a/configure.ac +++ b/configure.ac @@ -427,12 +427,7 @@ else fi -dnl Support for background operations -AC_ARG_ENABLE([background], - [ --enable-background Support for background file operations [[yes]]]) -if test "x$enable_background" != xno; then - AC_DEFINE(WITH_BACKGROUND, 1, [Define to enable background file operations]) -fi +MC_BACKGROUND dnl @@ -643,6 +638,7 @@ Configuration: Mouse support: ${mouse_lib} X11 events support: ${textmode_x11_support} With subshell support: ${subshell} + With background operations: ${enable_background} Internal editor: ${edit_msg} Diff viewer: ${diff_msg} Support for charset: ${charset_msg} diff --git a/lib/global.c b/lib/global.c index 2a9fc620d..29ad615e0 100644 --- a/lib/global.c +++ b/lib/global.c @@ -49,9 +49,9 @@ /* *INDENT-OFF* */ mc_global_t mc_global = { -#ifdef WITH_BACKGROUND +#ifdef ENABLE_BACKGROUND .we_are_background = 0, -#endif /* WITH_BACKGROUND */ +#endif /* ENABLE_BACKGROUND */ .message_visible = 1, .keybar_visible = 1, diff --git a/lib/global.h b/lib/global.h index ad9337368..4303fa894 100644 --- a/lib/global.h +++ b/lib/global.h @@ -159,10 +159,10 @@ typedef enum typedef struct { -#ifdef WITH_BACKGROUND +#ifdef ENABLE_BACKGROUND /* If true, this is a background process */ int we_are_background; -#endif /* WITH_BACKGROUND */ +#endif /* ENABLE_BACKGROUND */ /* * If utf-8 terminal utf8_display = 1 diff --git a/lib/keybind.c b/lib/keybind.c index cdae181f6..2b7aaeea8 100644 --- a/lib/keybind.c +++ b/lib/keybind.c @@ -167,7 +167,7 @@ static name_keymap_t command_names[] = { {"ConnectSmb", CK_ConnectSmb}, #endif {"PanelInfo", CK_PanelInfo}, -#ifdef WITH_BACKGROUND +#ifdef ENABLE_BACKGROUND {"Jobs", CK_Jobs}, #endif {"OptionsLayout", CK_OptionsLayout}, diff --git a/lib/widget/dialog-switch.c b/lib/widget/dialog-switch.c index 3dd22f0e9..5188cfab6 100644 --- a/lib/widget/dialog-switch.c +++ b/lib/widget/dialog-switch.c @@ -354,10 +354,10 @@ repaint_screen (void) void mc_refresh (void) { -#ifdef WITH_BACKGROUND +#ifdef ENABLE_BACKGROUND if (mc_global.we_are_background) return; -#endif /* WITH_BACKGROUND */ +#endif /* ENABLE_BACKGROUND */ if (!mc_global.tty.winch_flag) tty_refresh (); else diff --git a/lib/widget/wtools.c b/lib/widget/wtools.c index 1b8a47f9f..360d58a45 100644 --- a/lib/widget/wtools.c +++ b/lib/widget/wtools.c @@ -154,7 +154,7 @@ fg_message (int flags, const char *title, const char *text) /* --------------------------------------------------------------------------------------------- */ /** Show message box from background */ -#ifdef WITH_BACKGROUND +#ifdef ENABLE_BACKGROUND static void bg_message (int dummy, int *flags, char *title, const char *text) { @@ -163,7 +163,7 @@ bg_message (int dummy, int *flags, char *title, const char *text) fg_message (*flags, title, text); g_free (title); } -#endif /* WITH_BACKGROUND */ +#endif /* ENABLE_BACKGROUND */ /* --------------------------------------------------------------------------------------------- */ @@ -269,7 +269,7 @@ fg_input_dialog_help (const char *header, const char *text, const char *help, /* --------------------------------------------------------------------------------------------- */ -#ifdef WITH_BACKGROUND +#ifdef ENABLE_BACKGROUND static int wtools_parent_call (void *routine, gpointer ctx, int argc, ...) { @@ -298,7 +298,7 @@ wtools_parent_call_string (void *routine, int argc, ...) va_end (event_data.ap); return event_data.ret.s; } -#endif /* WITH_BACKGROUND */ +#endif /* ENABLE_BACKGROUND */ /* --------------------------------------------------------------------------------------------- */ /*** public functions ****************************************************************************/ @@ -444,7 +444,7 @@ message (int flags, const char *title, const char *text, ...) if (title == MSG_ERROR) title = _("Error"); -#ifdef WITH_BACKGROUND +#ifdef ENABLE_BACKGROUND if (mc_global.we_are_background) { union @@ -458,7 +458,7 @@ message (int flags, const char *title, const char *text, ...) strlen (p), p); } else -#endif /* WITH_BACKGROUND */ +#endif /* ENABLE_BACKGROUND */ fg_message (flags, title, p); g_free (p); @@ -476,7 +476,7 @@ char * input_dialog_help (const char *header, const char *text, const char *help, const char *history_name, const char *def_text) { -#ifdef WITH_BACKGROUND +#ifdef ENABLE_BACKGROUND if (mc_global.we_are_background) { union @@ -492,7 +492,7 @@ input_dialog_help (const char *header, const char *text, const char *help, strlen (def_text), def_text); } else -#endif /* WITH_BACKGROUND */ +#endif /* ENABLE_BACKGROUND */ return fg_input_dialog_help (header, text, help, history_name, def_text); } diff --git a/m4.include/mc-background.m4 b/m4.include/mc-background.m4 new file mode 100644 index 000000000..360b828d1 --- /dev/null +++ b/m4.include/mc-background.m4 @@ -0,0 +1,23 @@ +dnl +dnl Support for background operations +dnl + +AC_DEFUN([MC_BACKGROUND], +[ + AC_ARG_ENABLE([background], + AS_HELP_STRING([--enable-background], [Support for background file operations [[yes]]]), + [ + if test "x$enableval" = xno; then + enable_background=no + else + enable_background=yes + fi + ], + [enable_background=yes]) + + if test "x$enable_background" = xyes; then + AC_DEFINE(ENABLE_BACKGROUND, 1, [Define to enable background file operations]) + fi + + AM_CONDITIONAL(ENABLE_BACKGROUND, [test "x$enable_background" = xyes]) +]) diff --git a/src/Makefile.am b/src/Makefile.am index c87ac8f3d..ada0214ba 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -52,7 +52,6 @@ SRC_mc_conssaver = \ mc_SOURCES = \ $(SRC_mc_conssaver) \ args.c args.h \ - background.c background.h \ clipboard.c clipboard.h \ events_init.c events_init.h \ execute.c execute.h \ @@ -70,6 +69,10 @@ if CHARSET mc_SOURCES += selcodepage.c selcodepage.h endif +if ENABLE_BACKGROUND + mc_SOURCES += background.c background.h +endif + EXTRA_DIST = $(SRC_maintainer) $(SRC_charset) # end of automated testing diff --git a/src/background.c b/src/background.c index aac4aff8d..6941e9416 100644 --- a/src/background.c +++ b/src/background.c @@ -33,8 +33,6 @@ #include -#ifdef WITH_BACKGROUND - #include #include #include @@ -640,5 +638,3 @@ background_parent_call_string (const gchar * event_group_name, const gchar * eve } /* --------------------------------------------------------------------------------------------- */ - -#endif /* WITH_BACKGROUND */ diff --git a/src/background.h b/src/background.h index cf5daac19..1869528ed 100644 --- a/src/background.h +++ b/src/background.h @@ -5,8 +5,6 @@ #ifndef MC__BACKGROUND_H #define MC__BACKGROUND_H -#ifdef WITH_BACKGROUND - #include /* pid_t */ /*** typedefs(not structures) and defined constants **********************************************/ @@ -55,6 +53,4 @@ background_parent_call_string (const gchar * event_group_name, const gchar * eve /*** inline functions ****************************************************************************/ -#endif /* !WITH_BACKGROUND */ - #endif /* MC__BACKGROUND_H */ diff --git a/src/events_init.c b/src/events_init.c index 35930e8cd..a84daaf2b 100644 --- a/src/events_init.c +++ b/src/events_init.c @@ -29,9 +29,9 @@ #include "lib/event.h" -#ifdef WITH_BACKGROUND +#ifdef ENABLE_BACKGROUND #include "background.h" /* (background_parent_call), background_parent_call_string() */ -#endif /* WITH_BACKGROUND */ +#endif /* ENABLE_BACKGROUND */ #include "clipboard.h" /* clipboard events */ #include "execute.h" /* execute_suspend() */ #include "help.h" /* help_interactive_display() */ @@ -68,10 +68,10 @@ events_init (GError ** error) {MCEVENT_GROUP_CORE, "help", help_interactive_display, NULL}, {MCEVENT_GROUP_CORE, "suspend", execute_suspend, NULL}, -#ifdef WITH_BACKGROUND +#ifdef ENABLE_BACKGROUND {MCEVENT_GROUP_CORE, "background_parent_call", background_parent_call, NULL}, {MCEVENT_GROUP_CORE, "background_parent_call_string", background_parent_call_string, NULL}, -#endif /* WITH_BACKGROUND */ +#endif /* ENABLE_BACKGROUND */ {NULL, NULL, NULL, NULL} }; diff --git a/src/filemanager/boxes.c b/src/filemanager/boxes.c index 7abc8dc21..e0d6aef9e 100644 --- a/src/filemanager/boxes.c +++ b/src/filemanager/boxes.c @@ -59,7 +59,9 @@ #include "lib/widget.h" #include "src/setup.h" /* For profile_name */ +#ifdef ENABLE_BACKGROUND #include "src/background.h" /* task_list */ +#endif #ifdef HAVE_CHARSET #include "lib/charsets.h" @@ -88,12 +90,12 @@ #endif /* ENABLE_VFS_FTP */ #endif /* ENABLE_VFS */ -#ifdef WITH_BACKGROUND +#ifdef ENABLE_BACKGROUND #define B_STOP (B_USER+1) #define B_RESUME (B_USER+2) #define B_KILL (B_USER+3) #define JOBS_Y 15 -#endif /* WITH_BACKGROUND */ +#endif /* ENABLE_BACKGROUND */ /*** file scope type declarations ****************************************************************/ @@ -121,7 +123,7 @@ static char *ret_directory_timeout; #endif /* ENABLE_VFS_FTP */ #endif /* ENABLE_VFS */ -#ifdef WITH_BACKGROUND +#ifdef ENABLE_BACKGROUND static int JOBS_X = 60; static WListbox *bg_list; static Dlg_head *jobs_dlg; @@ -145,7 +147,7 @@ job_buttons[] = /* *INDENT-ON* */ }; -#endif /* WITH_BACKGROUND */ +#endif /* ENABLE_BACKGROUND */ /*** file scope functions ************************************************************************/ /* --------------------------------------------------------------------------------------------- */ @@ -449,7 +451,7 @@ confvfs_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void * #endif /* ENABLE_VFS_FTP */ #endif /* ENABLE_VFS */ -#ifdef WITH_BACKGROUND +#ifdef ENABLE_BACKGROUND static void jobs_fill_listbox (void) { @@ -519,7 +521,7 @@ task_cb (WButton * button, int action) return 0; } -#endif /* WITH_BACKGROUND */ +#endif /* ENABLE_BACKGROUND */ /* --------------------------------------------------------------------------------------------- */ /*** public functions ****************************************************************************/ @@ -1074,7 +1076,7 @@ symlink_dialog (const vfs_path_t * existing_vpath, const vfs_path_t * new_vpath, /* --------------------------------------------------------------------------------------------- */ -#ifdef WITH_BACKGROUND +#ifdef ENABLE_BACKGROUND void jobs_cmd (void) { @@ -1128,7 +1130,7 @@ jobs_cmd (void) destroy_dlg (jobs_dlg); } -#endif /* WITH_BACKGROUND */ +#endif /* ENABLE_BACKGROUND */ /* --------------------------------------------------------------------------------------------- */ diff --git a/src/filemanager/file.c b/src/filemanager/file.c index 29271a62c..8663268ef 100644 --- a/src/filemanager/file.c +++ b/src/filemanager/file.c @@ -72,7 +72,9 @@ #include "lib/widget.h" #include "src/setup.h" -#include "src/background.h" +#ifdef ENABLE_BACKGROUND +#include "src/background.h" /* do_background() */ +#endif #include "layout.h" /* rotate_dash() */ @@ -522,7 +524,7 @@ real_warn_same_file (enum OperationMode mode, const char *fmt, const char *a, co static FileProgressStatus warn_same_file (const char *fmt, const char *a, const char *b) { -#ifdef WITH_BACKGROUND +#ifdef ENABLE_BACKGROUND /* *INDENT-OFF* */ union { @@ -617,7 +619,7 @@ real_query_recursive (FileOpContext * ctx, enum OperationMode mode, const char * /* --------------------------------------------------------------------------------------------- */ -#ifdef WITH_BACKGROUND +#ifdef ENABLE_BACKGROUND static FileProgressStatus do_file_error (const char *str) { @@ -699,7 +701,7 @@ query_replace (FileOpContext * ctx, const char *destname, struct stat *_s_stat, return file_progress_real_query_replace (ctx, Foreground, destname, _s_stat, _d_stat); } -#endif /* !WITH_BACKGROUND */ +#endif /* !ENABLE_BACKGROUND */ /* --------------------------------------------------------------------------------------------- */ /** Report error with two files */ @@ -1362,7 +1364,7 @@ panel_operate_generate_prompt (const WPanel * panel, FileOperation operation, /* --------------------------------------------------------------------------------------------- */ -#ifdef WITH_BACKGROUND +#ifdef ENABLE_BACKGROUND static int end_bg_process (FileOpContext * ctx, enum OperationMode mode) { @@ -2750,7 +2752,7 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl file_op_context_create_ui (ctx, TRUE, dialog_type); } -#ifdef WITH_BACKGROUND +#ifdef ENABLE_BACKGROUND /* Did the user select to do a background operation? */ if (do_bg) { @@ -2775,7 +2777,7 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl return FALSE; } } -#endif /* WITH_BACKGROUND */ +#endif /* ENABLE_BACKGROUND */ /* Initialize things */ /* We do not want to trash cache every time file is @@ -3036,7 +3038,7 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl g_free (ctx->dest_mask); ctx->dest_mask = NULL; -#ifdef WITH_BACKGROUND +#ifdef ENABLE_BACKGROUND /* Let our parent know we are saying bye bye */ if (mc_global.we_are_background) { @@ -3049,7 +3051,7 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl vfs_shut (); _exit (0); } -#endif /* WITH_BACKGROUND */ +#endif /* ENABLE_BACKGROUND */ file_op_total_context_destroy (tctx); ret_fast: diff --git a/src/filemanager/filegui.c b/src/filemanager/filegui.c index 3b44ee916..2cee13c1c 100644 --- a/src/filemanager/filegui.c +++ b/src/filemanager/filegui.c @@ -955,12 +955,12 @@ file_mask_dialog (FileOpContext * ctx, FileOperation operation, QuickWidget fmd_widgets[] = { /* 0 */ QUICK_BUTTON (42, 64, 10, FMDY, N_("&Cancel"), B_CANCEL, NULL), -#ifdef WITH_BACKGROUND +#ifdef ENABLE_BACKGROUND /* 1 */ QUICK_BUTTON (25, 64, 10, FMDY, N_("&Background"), B_USER, NULL), #define OFFSET 0 #else #define OFFSET 1 -#endif /* WITH_BACKGROUND */ +#endif /* ENABLE_BACKGROUND */ /* 2 - OFFSET */ QUICK_BUTTON (14, FMDX, 10, FMDY, N_("&OK"), B_ENTER, NULL), /* 3 - OFFSET */ @@ -1011,7 +1011,7 @@ file_mask_dialog (FileOpContext * ctx, FileOperation operation, /* buttons */ b2_len = str_term_width1 (fmd_widgets[2 - OFFSET].u.button.text) + 6 + gap; /* OK */ -#ifdef WITH_BACKGROUND +#ifdef ENABLE_BACKGROUND b1_len = str_term_width1 (fmd_widgets[1].u.button.text) + 4 + gap; /* Background */ #endif b0_len = str_term_width1 (fmd_widgets[0].u.button.text) + 4; /* Cancel */ @@ -1039,7 +1039,7 @@ file_mask_dialog (FileOpContext * ctx, FileOperation operation, /* OK button */ fmd_widgets[2 - OFFSET].relative_x = i; i += b2_len; -#ifdef WITH_BACKGROUND +#ifdef ENABLE_BACKGROUND /* Background button */ fmd_widgets[1].relative_x = i; i += b1_len; diff --git a/src/filemanager/layout.c b/src/filemanager/layout.c index caa87c4ff..518b05b37 100644 --- a/src/filemanager/layout.c +++ b/src/filemanager/layout.c @@ -51,7 +51,6 @@ #include "src/consaver/cons.saver.h" #include "src/viewer/mcviewer.h" /* The view widget */ #include "src/setup.h" -#include "src/background.h" #ifdef HAVE_SUBSHELL_SUPPORT #include "src/main.h" /* do_load_prompt() */ #include "src/subshell.h" diff --git a/src/filemanager/midnight.c b/src/filemanager/midnight.c index 8b0455546..6c365c70e 100644 --- a/src/filemanager/midnight.c +++ b/src/filemanager/midnight.c @@ -288,7 +288,7 @@ create_command_menu (void) #ifdef ENABLE_VFS entries = g_list_prepend (entries, menu_entry_create (_("&Active VFS list"), CK_VfsList)); #endif -#ifdef WITH_BACKGROUND +#ifdef ENABLE_BACKGROUND entries = g_list_prepend (entries, menu_entry_create (_("&Background jobs"), CK_Jobs)); #endif entries = g_list_prepend (entries, menu_entry_create (_("Screen lis&t"), CK_ScreenList)); @@ -1202,7 +1202,7 @@ midnight_execute_cmd (Widget * sender, unsigned long command) else info_cmd_no_menu (); /* shortcut or buttonbar */ break; -#ifdef WITH_BACKGROUND +#ifdef ENABLE_BACKGROUND case CK_Jobs: jobs_cmd (); break; diff --git a/src/keybind-defaults.c b/src/keybind-defaults.c index ef5ea692d..397464608 100644 --- a/src/keybind-defaults.c +++ b/src/keybind-defaults.c @@ -153,9 +153,9 @@ static const global_keymap_ini_t default_main_x_keymap[] = { {"PanelInfo", "i"}, {"PanelQuickView", "q"}, {"HotListAdd", "h"}, -#ifdef WITH_BACKGROUND +#ifdef ENABLE_BACKGROUND {"Jobs", "j"}, -#endif /* WITH_BACKGROUND */ +#endif /* ENABLE_BACKGROUND */ {"ExternalPanelize", "!"}, {NULL, NULL} }; diff --git a/src/textconf.c b/src/textconf.c index 8d37186dc..a68cba7c2 100644 --- a/src/textconf.c +++ b/src/textconf.c @@ -97,7 +97,7 @@ static const char *const features[] = { #endif #endif /* !HAVE_SUBSHELL_SUPPORT */ -#ifdef WITH_BACKGROUND +#ifdef ENABLE_BACKGROUND N_("With support for background operations\n"), #endif