1
1
Ok, finally splitted the GUI code that dealt with the file operations into
a separate file.  It is now possible to write a native Gtk version of this.

Until the Gtk-native version is done, the code in mc/gnome/ is linking with
filegui.c.

Miguel
Этот коммит содержится в:
Miguel de Icaza 1998-11-18 02:31:23 +00:00
родитель df043d5454
Коммит a7996c0a20
16 изменённых файлов: 1452 добавлений и 1235 удалений

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

@ -81,7 +81,7 @@ OOBJS = main.o dlg.o screen.o widget.o wtools.o info.o boxes.o \
win.o color.o profile.o user.o ext.o setup.o tree.o \
subshell.o terms.o achown.o fsusage.o mountlist.o \
@XCURSES@ @REGEX_O@ complete.o command.o \
option.o cmd.o utilunix.o xslint.o
option.o cmd.o utilunix.o xslint.o filegui.o
OBJS = $(LOBJS) $(OOBJS) \
gdesktop-icon.o \
@ -158,7 +158,7 @@ checklinks:
links:
for I in $(LOBJS); do $(RMF) $$I; $(LN_S) ../src/$$I $$I >/dev/null 2>&1; done; true
sourcelinks:
maksourcelinks:
-cd $(gnomedir); $(LN_S) ../src/*.[ch] . >/dev/null 2>&1; $(LN_S) ../src/*.inc .; true
cleansourcelinks:

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

@ -1,3 +1,9 @@
1998-11-17 Miguel de Icaza <miguel@nuclecu.unam.mx>
* filegui.c: New file. We keep all of the user interface code for
the text edition in this file now. This should be a per-GUI port
file.
1998-11-11 Federico Mena Quintero <federico@nuclecu.unam.mx>
* panel.h (WPanel): Instead of the "#ifdef GNOME" mess in the

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

@ -16,36 +16,36 @@ INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
SRCS = dir.c util.c main.c screen.c dialog.c key.c keyxdef.c menu.c\
file.c win.c color.c help.c find.c profile.c user.c view.c \
ext.c mouse.c setup.c dlg.c option.c info.c \
tree.c widget.c chmod.c mad.c xcurses.c xslint.c \
wtools.c cons.handler.c chown.c subshell.c terms.c boxes.c \
hotlist.c achown.c layout.c fsusage.c mountlist.c regex.c \
complete.c slint.c command.c cmd.c panelize.c learn.c \
listmode.c utilunix.c background.c rxvt.c \
text.c popt.c findme.c poptparse.c poptconfig.c popthelp.c
SRCS = dir.c util.c main.c screen.c dialog.c key.c keyxdef.c menu.c \
file.c win.c color.c help.c find.c profile.c user.c view.c \
ext.c mouse.c setup.c dlg.c option.c info.c \
tree.c widget.c chmod.c mad.c xcurses.c xslint.c \
wtools.c cons.handler.c chown.c subshell.c terms.c boxes.c \
hotlist.c achown.c layout.c fsusage.c mountlist.c regex.c \
complete.c slint.c command.c cmd.c panelize.c learn.c \
listmode.c utilunix.c background.c rxvt.c \
text.c popt.c findme.c poptparse.c poptconfig.c popthelp.c \
filegui.c
HDRS = color.h file.h mouse.h user.h dialog.h find.h main.h \
util.h dir.h global.h menu.h panel.h win.h mem.h \
help.h profile.h dlg.h option.h tree.h info.h \
widget.h chmod.h cons.saver.h mad.h wtools.h chown.h \
subshell.h view.h setup.h key.h ext.h boxes.h \
hotlist.h layout.h fsusage.h mountlist.h regex.h complete.h \
myslang.h command.h cmd.h tty.h fs.h panelize.h achown.h \
learn.h listmode.h features.inc background.h \
x.h textconf.h i18n.h findme.h popt.h
HDRS = color.h file.h mouse.h user.h dialog.h find.h main.h \
util.h dir.h global.h menu.h panel.h win.h mem.h \
help.h profile.h dlg.h option.h tree.h info.h \
widget.h chmod.h cons.saver.h mad.h wtools.h chown.h \
subshell.h view.h setup.h key.h ext.h boxes.h \
hotlist.h layout.h fsusage.h mountlist.h regex.h complete.h \
myslang.h command.h cmd.h tty.h fs.h panelize.h achown.h \
learn.h listmode.h features.inc background.h \
x.h textconf.h i18n.h findme.h popt.h filegui.h
OBJS = dir.o util.o screen.o dialog.o key.o keyxdef.o menu.o\
file.o win.o color.o help.o find.o profile.o user.o view.o \
ext.o mouse.o setup.o dlg.o option.o \
tree.o widget.o chmod.o mad.o wtools.o info.o \
cons.handler.o chown.o subshell.o terms.o boxes.o \
hotlist.o achown.o layout.o fsusage.o mountlist.o \
@XCURSES@ @REGEX_O@ complete.o slint.o command.o \
cmd.o main.o panelize.o learn.o listmode.o utilunix.o \
background.o rxvt.o text.o \
popt.o findme.o poptparse.o poptconfig.o popthelp.o
OBJS = dir.o util.o screen.o dialog.o key.o keyxdef.o menu.o \
file.o win.o color.o help.o find.o profile.o user.o view.o \
ext.o mouse.o setup.o dlg.o option.o tree.o widget.o chmod.o \
mad.o wtools.o info.o cons.handler.o chown.o subshell.o \
terms.o boxes.o hotlist.o achown.o layout.o fsusage.o \
mountlist.o @XCURSES@ @REGEX_O@ complete.o slint.o command.o \
cmd.o main.o panelize.o learn.o listmode.o utilunix.o \
background.o rxvt.o text.o popt.o findme.o poptparse.o \
poptconfig.o popthelp.o filegui.o
#
# Distribution variables
@ -61,7 +61,8 @@ DISTFILES = \
all: mc mcmfmt @saver_target@ Makefile
Makefile: $(srcdir)/Makefile.in $(builddir)/config.status
cd $(builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
cd $(builddir) && CONFIG_FILES=src/Makefile CONFIG_HEADERS= $(SHELL) ./config.status
.c.o:
$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $<

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

@ -51,10 +51,12 @@
#endif
#include "util.h"
#include "dialog.h"
#include "file.h"
#include "background.h"
#include "mad.h"
#include "key.h" /* For add_select_channel(), delete_select_channel() */
#include "regex.h"
#include "file.h"
#include "filegui.h"
/* If true, this is a background process */
int we_are_background = 0;
@ -340,9 +342,9 @@ background_attention (int fd, void *xpid)
}
/* Send the result code and the value for shared variables */
write (fd, &result, sizeof (int));
write (fd, &do_append, sizeof (do_append));
write (fd, &recursive_result, sizeof (recursive_result));
write (fd, &result, sizeof (int));
write (fd, &file_progress_do_append, sizeof (file_progress_do_append));
write (fd, &file_progress_recursive_result, sizeof (file_progress_recursive_result));
} else if (type == Return_String) {
int len;
@ -423,8 +425,8 @@ parent_call (void *routine, int argc, ...)
* variables that may be modified in the parent that affect our behaviour
*/
read (parent_fd, &i, sizeof (int));
read (parent_fd, &do_append, sizeof (do_append));
read (parent_fd, &recursive_result, sizeof (recursive_result));
read (parent_fd, &file_progress_do_append, sizeof (file_progress_do_append));
read (parent_fd, &file_progress_recursive_result, sizeof (file_progress_recursive_result));
return i;
}

1420
src/file.c

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -1,26 +1,60 @@
#ifndef __FILE_H
#define __FILE_H
enum { OP_COPY, OP_MOVE, OP_DELETE };
enum { FILE_CONT, FILE_RETRY, FILE_SKIP, FILE_ABORT };
#include "background.h"
typedef enum {
OP_COPY,
OP_MOVE,
OP_DELETE
} FileOperation;
extern char *op_names [3];
typedef enum {
FILE_CONT,
FILE_RETRY,
FILE_SKIP,
FILE_ABORT
} FileProgressStatus;
enum {
RECURSIVE_YES,
RECURSIVE_NO,
RECURSIVE_ALWAYS,
RECURSIVE_NEVER,
RECURSIVE_ABORT
} FileCopyMode;
extern int verbose;
extern int know_not_what_am_i_doing;
struct link;
int copy_file_file (char *s, char *d, int ask_overwrite);
int move_file_file (char *s, char *d);
int erase_dir (char *s);
int copy_file_file (char *s, char *d, int ask_overwrite);
int move_file_file (char *s, char *d);
int erase_dir (char *s);
int erase_dir_iff_empty (char *s);
int move_dir_dir (char *s, char *d);
int copy_dir_dir (char *s, char *d, int toplevel, int move_over, int delete, struct link *parent_dirs);
int move_dir_dir (char *s, char *d);
int copy_dir_dir (char *s, char *d, int toplevel, int move_over,
int delete, struct link *parent_dirs);
void create_op_win (int op, int with_eta);
void destroy_op_win (void);
void refresh_op_win (void);
int panel_operate (void *source_panel, int op, char *thedefault);
void file_mask_defaults (void);
/*
* Manually creating the copy/move/delte dialogs
*/
void create_op_win (FileOperation op, int with_eta);
void destroy_op_win (void);
void refresh_op_win (void);
int panel_operate (void *source_panel, FileOperation op, char *thedefault);
void file_mask_defaults (void);
char *file_mask_dialog (FileOperation operation, char *text, char *def_text,
int only_one, int *do_background);
#ifdef WANT_WIDGETS
char *panel_operate_generate_prompt (char* cmd_buf,
WPanel* panel,
int operation, int only_one,
struct stat* src_stat);
#endif
extern int dive_into_subdirs;
@ -48,4 +82,7 @@ extern int dive_into_subdirs;
int background_attention (int fd, void *info);
extern int background_wait;
int is_wildcarded (char *p);
#endif

1052
src/filegui.c Обычный файл

Разница между файлами не показана из-за своего большого размера Загрузить разницу

56
src/filegui.h Обычный файл
Просмотреть файл

@ -0,0 +1,56 @@
#ifndef __FILEGUI_H
#define __FILEGUI_H
/*
* GUI callback routines
*/
FileProgressStatus file_progress_check_buttons (void);
FileProgressStatus file_progress_show (long done, long total);
FileProgressStatus file_progress_show_count (long done, long total);
FileProgressStatus file_progress_show_bytes (long done, long total);
FileProgressStatus file_progress_real_query_replace (enum OperationMode mode,
char *destname,
struct stat *_s_stat,
struct stat *_d_stat);
void file_progress_set_stalled_label (char *stalled_msg);
/*
* Shared variables used to pass information from the file.c module to
* the GUI modules. Yes, this is hackish.
*
* This will be replaced with a FileOpContext soon (which will be created with
* create_op_win).
*
* Now, the reason this has not happened yet is that it needs to be done in
* sync with the background.c code (status result is passed trough the pipe
* and this needs to be handled properly, probably by creating a temporary
* FileOpContext and using this).
*
*/
extern int file_progress_replace_result;
extern int file_progress_recursive_result;
extern char *file_progress_replace_filename;
extern double file_progress_eta_secs;
extern int file_progress_do_reget;
extern int file_progress_do_append;
extern int file_mask_op_follow_links;
extern int file_mask_stable_symlinks;
extern int file_mask_preserve;
extern int file_mask_preserve_uidgid;
extern int file_mask_umask_kill;
extern char *file_mask_dest_mask;
extern unsigned long file_progress_bps;
extern unsigned long file_progress_bps_time;
int (*file_mask_xstat)(char *, struct stat *);
extern struct re_pattern_buffer file_mask_rx;
#ifdef WANT_WIDGETS
char *panel_get_file (WPanel *panel, struct stat *stat_buf);
#endif
#endif

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

@ -38,8 +38,7 @@
#include "win.h"
#include "color.h"
#include "global.h"
extern int verbose; /* Should be in a more sensible header file */
#include "setup.h"
/* Dialog manager and widgets */
#include "dlg.h"

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

@ -47,7 +47,6 @@
#include "mouse.h"
#include "key.h"
#include "main.h"
#include "file.h"
#include "win.h"
#include "cons.saver.h"
#include "../vfs/vfs.h"

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

@ -829,7 +829,6 @@ void change_screen_size (void)
}
#endif /* HAVE_X */
extern int verbose;
static int ok_to_refresh = 1;
void use_dash (int flag)

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

@ -25,7 +25,6 @@
#include <stdio.h>
#include "mad.h"
#include "dir.h"
#include "file.h"
#include "global.h"
#include "util.h" /* Functions and externs */
#include "panel.h"
@ -43,6 +42,7 @@
#include "menu.h" /* menubar_visible declaration */
#include "win.h" /* lookup_key */
#include "cmd.h"
#include "file.h"
#include "x.h"
#ifdef HAVE_GNOME

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

@ -25,6 +25,7 @@ extern char color_terminal_string [];
extern int startup_left_mode;
extern int startup_right_mode;
extern int verbose;
#ifdef OS2_NT
# define PROFILE_NAME "mc.ini"

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

@ -37,6 +37,7 @@
#include "main.h"
#include "user.h"
#include "layout.h"
#include "setup.h"
#include "../vfs/vfs.h"
/* For the simple listbox manager */
@ -601,7 +602,6 @@ menu_file_own(char* path)
}
else
{
extern int verbose;
if (verbose)
{
message (0, _(" Warning -- ignoring file "),

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

@ -58,12 +58,12 @@
#include "widget.h" /* Needed for buttonbar_new */
#include "color.h"
#include "dialog.h"
#include "file.h"
#include "mouse.h"
#include "global.h"
#include "help.h"
#include "key.h" /* For mi_getch() */
#include "layout.h"
#include "setup.h"
#include "wtools.h" /* For query_set_sel() */
#if defined(HAVE_RX_H) && defined(HAVE_REGCOMP)
# include <rx.h>

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

@ -38,6 +38,7 @@ VFSSRCS = \
extfs.c \
ftpfs.c \
fish.c \
direntry.c \
local.c \
mcfs.c \
names.c \