1
1

Tweak background operations support.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
Andrew Borodin 2012-01-09 14:48:39 +03:00 коммит произвёл Slava Zanko
родитель 793546fed4
Коммит c7bde637f9
19 изменённых файлов: 79 добавлений и 61 удалений

Просмотреть файл

@ -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])

Просмотреть файл

@ -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}

Просмотреть файл

@ -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,

Просмотреть файл

@ -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

Просмотреть файл

@ -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},

Просмотреть файл

@ -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

Просмотреть файл

@ -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);
}

23
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])
])

Просмотреть файл

@ -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

Просмотреть файл

@ -33,8 +33,6 @@
#include <config.h>
#ifdef WITH_BACKGROUND
#include <stdlib.h>
#include <errno.h>
#include <signal.h>
@ -640,5 +638,3 @@ background_parent_call_string (const gchar * event_group_name, const gchar * eve
}
/* --------------------------------------------------------------------------------------------- */
#endif /* WITH_BACKGROUND */

Просмотреть файл

@ -5,8 +5,6 @@
#ifndef MC__BACKGROUND_H
#define MC__BACKGROUND_H
#ifdef WITH_BACKGROUND
#include <sys/types.h> /* 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 */

Просмотреть файл

@ -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}
};

Просмотреть файл

@ -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 */
/* --------------------------------------------------------------------------------------------- */

Просмотреть файл

@ -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:

Просмотреть файл

@ -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;

Просмотреть файл

@ -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"

Просмотреть файл

@ -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;

Просмотреть файл

@ -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}
};

Просмотреть файл

@ -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