mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-09 13:02:01 +03:00
moved functions around...
This commit is contained in:
parent
a065078165
commit
b081558a24
@ -1,3 +1,10 @@
|
|||||||
|
1998-12-01 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
|
* Makefile.in: now handles gdialogs*
|
||||||
|
|
||||||
|
* gdialogs.h:
|
||||||
|
* gdialogs.c:Added new files -- takes the place of ../src/filegui.*
|
||||||
|
|
||||||
1998-12-01 Miguel de Icaza <miguel@nuclecu.unam.mx>
|
1998-12-01 Miguel de Icaza <miguel@nuclecu.unam.mx>
|
||||||
|
|
||||||
* gscreen.c (panel_switch_new_display_mode): Destroy the old
|
* gscreen.c (panel_switch_new_display_mode): Destroy the old
|
||||||
|
@ -33,6 +33,7 @@ GNOMESRCS = \
|
|||||||
gpageprop.c \
|
gpageprop.c \
|
||||||
gpopup.c \
|
gpopup.c \
|
||||||
gprop.c \
|
gprop.c \
|
||||||
|
gdialogs.c \
|
||||||
gscreen.c \
|
gscreen.c \
|
||||||
gtools.c \
|
gtools.c \
|
||||||
gtree.c \
|
gtree.c \
|
||||||
@ -55,6 +56,7 @@ GNOMEHDRS = \
|
|||||||
gpageprop.h \
|
gpageprop.h \
|
||||||
gpopup.h \
|
gpopup.h \
|
||||||
gprop.h \
|
gprop.h \
|
||||||
|
gdialogs.h \
|
||||||
gscreen.h \
|
gscreen.h \
|
||||||
gtree.h \
|
gtree.h \
|
||||||
gwidget.h
|
gwidget.h
|
||||||
@ -85,7 +87,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 \
|
win.o color.o profile.o user.o ext.o setup.o tree.o \
|
||||||
subshell.o terms.o achown.o fsusage.o mountlist.o \
|
subshell.o terms.o achown.o fsusage.o mountlist.o \
|
||||||
@XCURSES@ @REGEX_O@ complete.o command.o \
|
@XCURSES@ @REGEX_O@ complete.o command.o \
|
||||||
option.o cmd.o utilunix.o xslint.o filegui.o
|
option.o cmd.o utilunix.o xslint.o gdialogs.o
|
||||||
|
|
||||||
OBJS = $(LOBJS) $(OOBJS) \
|
OBJS = $(LOBJS) $(OOBJS) \
|
||||||
gblist.o \
|
gblist.o \
|
||||||
|
96
gnome/gdialogs.c
Normal file
96
gnome/gdialogs.c
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
|
||||||
|
/* New dialogs... */
|
||||||
|
#include <gnome.h>
|
||||||
|
#include "../vfs/vfs.h"
|
||||||
|
#include "file.h"
|
||||||
|
#include "panel.h"
|
||||||
|
|
||||||
|
static GtkWidget *op_win = NULL;
|
||||||
|
|
||||||
|
FileProgressStatus
|
||||||
|
file_progress_show_source (char *path)
|
||||||
|
{
|
||||||
|
g_warning ("Show source!\n");
|
||||||
|
return FILE_CONT;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FileProgressStatus
|
||||||
|
file_progress_show_target (char *path)
|
||||||
|
{
|
||||||
|
g_warning ("memo: file_progress_show_target!\n");
|
||||||
|
return FILE_CONT;
|
||||||
|
}
|
||||||
|
|
||||||
|
FileProgressStatus
|
||||||
|
file_progress_show_deleting (char *path)
|
||||||
|
{
|
||||||
|
g_warning ("memo: file_progress_show_deleting!\n");
|
||||||
|
return FILE_CONT;
|
||||||
|
}
|
||||||
|
|
||||||
|
FileProgressStatus
|
||||||
|
file_progress_show (long done, long total)
|
||||||
|
{
|
||||||
|
g_warning ("memo: file_progress_show!\n");
|
||||||
|
return FILE_CONT;
|
||||||
|
}
|
||||||
|
|
||||||
|
FileProgressStatus
|
||||||
|
file_progress_show_count (long done, long total)
|
||||||
|
{
|
||||||
|
g_warning ("memo: file_progress_show_count!\n");
|
||||||
|
return FILE_CONT;
|
||||||
|
}
|
||||||
|
|
||||||
|
FileProgressStatus
|
||||||
|
file_progress_show_bytes (long done, long total)
|
||||||
|
{
|
||||||
|
g_warning ("memo: file_progress_show_bytes!\n");
|
||||||
|
return FILE_CONT;
|
||||||
|
}
|
||||||
|
|
||||||
|
FileProgressStatus
|
||||||
|
file_progress_real_query_replace (enum OperationMode mode, char *destname, struct stat *_s_stat, struct stat *_d_stat)
|
||||||
|
{
|
||||||
|
g_warning ("memo: file_progress_real_query_replace!\n");
|
||||||
|
return FILE_CONT;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
file_progress_set_stalled_label (char *stalled_msg)
|
||||||
|
{
|
||||||
|
g_warning ("memo: file_progress_set_stalled_label!\n");
|
||||||
|
}
|
||||||
|
char *
|
||||||
|
file_mask_dialog (FileOperation operation, char *text, char *def_text, int only_one, int *do_background)
|
||||||
|
{
|
||||||
|
g_warning ("memo: file_mask_dialog!\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
create_op_win (FileOperation op, int with_eta)
|
||||||
|
{
|
||||||
|
if (op_win == NULL) {
|
||||||
|
op_win = gnome_dialog_new ("Op Win -- change this title", GNOME_STOCK_BUTTON_CANCEL, NULL);
|
||||||
|
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (op_win)->vbox), gtk_label_new ("borp\n"), FALSE, FALSE, 0);
|
||||||
|
}
|
||||||
|
gtk_widget_show(GTK_WIDGET(op_win));
|
||||||
|
g_print ("create_op_win\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
destroy_op_win (void)
|
||||||
|
{
|
||||||
|
if (op_win) {
|
||||||
|
g_print ("hiding in destroy_op_win\n");
|
||||||
|
gtk_widget_hide (op_win);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void
|
||||||
|
fmd_init_i18n()
|
||||||
|
{
|
||||||
|
/* unneccessary func */
|
||||||
|
}
|
18
gnome/gdialogs.h
Normal file
18
gnome/gdialogs.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
|
||||||
|
/* New dialogs... */
|
||||||
|
#include "../vfs/vfs.h"
|
||||||
|
#include "file.h"
|
||||||
|
#include "panel.h"
|
||||||
|
|
||||||
|
FileProgressStatus file_progress_show_source (char *path);
|
||||||
|
FileProgressStatus file_progress_show_target (char *path);
|
||||||
|
FileProgressStatus file_progress_show_deleting (char *path);
|
||||||
|
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);
|
||||||
|
char *file_mask_dialog (FileOperation operation, char *text, char *def_text, int only_one, int *do_background);
|
||||||
|
void create_op_win (FileOperation op, int with_eta);
|
||||||
|
void destroy_op_win (void);
|
||||||
|
void fmd_init_i18n();
|
@ -1,3 +1,7 @@
|
|||||||
|
1998-12-01 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
|
* file.c (panel_operate_generate_prompt): moved from filegui.c
|
||||||
|
|
||||||
1998-11-30 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
1998-11-30 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
||||||
|
|
||||||
* panel.h (WPanel): Added the missing tree/pane/view_table fields
|
* panel.h (WPanel): Added the missing tree/pane/view_table fields
|
||||||
|
132
src/file.c
132
src/file.c
@ -1473,7 +1473,7 @@ panel_get_file (WPanel *panel, struct stat *stat_buf)
|
|||||||
|
|
||||||
/* No problem with Gnome, as get_current_type never returns view_tree there */
|
/* No problem with Gnome, as get_current_type never returns view_tree there */
|
||||||
if (get_current_type () == view_tree){
|
if (get_current_type () == view_tree){
|
||||||
WTree *tree = (WTree *)get_panel_widget (get_current_index ());
|
WTree *tree = (WTree *)get_panel_widget (get_current_index ());
|
||||||
|
|
||||||
mc_stat (tree->selected_ptr->name, stat_buf);
|
mc_stat (tree->selected_ptr->name, stat_buf);
|
||||||
return tree->selected_ptr->name;
|
return tree->selected_ptr->name;
|
||||||
@ -1958,3 +1958,133 @@ query_replace (char *destname, struct stat *_s_stat, struct stat *_d_stat)
|
|||||||
Local variables:
|
Local variables:
|
||||||
end:
|
end:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This array introduced to avoid translation problems. The former (op_names)
|
||||||
|
* is assumed to be nouns, suitable in dialog box titles; this one should
|
||||||
|
* contain whatever is used in prompt itself (i.e. in russian, it's verb).
|
||||||
|
* Notice first symbol - it is to fool gettext and force these strings to
|
||||||
|
* be different for it. First symbol is skipped while building a prompt.
|
||||||
|
* (I don't use spaces around the words, because someday they could be
|
||||||
|
* dropped, when widgets get smarter)
|
||||||
|
*/
|
||||||
|
static char *op_names1 [] = { N_("1Copy"), N_("1Move"), N_("1Delete") };
|
||||||
|
#define FMD_XLEN 64
|
||||||
|
|
||||||
|
int fmd_xlen = FMD_XLEN, fmd_i18n_flag = 0;
|
||||||
|
/*
|
||||||
|
* These are formats for building a prompt. Parts encoded as follows:
|
||||||
|
* %o - operation from op_names1
|
||||||
|
* %f - file/files or files/directories, as appropriate
|
||||||
|
* %m - "with source mask" or question mark for delete
|
||||||
|
* %s - source name (truncated)
|
||||||
|
* %d - number of marked files
|
||||||
|
*/
|
||||||
|
static char* one_format = N_("%o %f \"%s\"%m");
|
||||||
|
static char* many_format = N_("%o %d %f%m");
|
||||||
|
|
||||||
|
static char* prompt_parts [] =
|
||||||
|
{
|
||||||
|
N_("file"), N_("files"), N_("directory"), N_("directories"),
|
||||||
|
N_("files/directories"), N_(" with source mask:")
|
||||||
|
};
|
||||||
|
|
||||||
|
char*
|
||||||
|
panel_operate_generate_prompt (char* cmd_buf, WPanel* panel, int operation, int only_one,
|
||||||
|
struct stat* src_stat)
|
||||||
|
{
|
||||||
|
register char *sp, *cp;
|
||||||
|
register int i;
|
||||||
|
char format_string [200];
|
||||||
|
char *dp = format_string;
|
||||||
|
char* source = NULL;
|
||||||
|
|
||||||
|
#ifdef ENABLE_NLS
|
||||||
|
static int i18n_flag = 0;
|
||||||
|
if (!i18n_flag)
|
||||||
|
{
|
||||||
|
if (!fmd_i18n_flag)
|
||||||
|
fmd_init_i18n(); /* to get proper fmd_xlen */
|
||||||
|
|
||||||
|
for (i = sizeof (op_names1) / sizeof (op_names1 [0]); i--;)
|
||||||
|
op_names1 [i] = _(op_names1 [i]);
|
||||||
|
|
||||||
|
for (i = sizeof (prompt_parts) / sizeof (prompt_parts [0]); i--;)
|
||||||
|
prompt_parts [i] = _(prompt_parts [i]);
|
||||||
|
|
||||||
|
one_format = _(one_format);
|
||||||
|
many_format = _(many_format);
|
||||||
|
i18n_flag = 1;
|
||||||
|
}
|
||||||
|
#endif /* ENABLE_NLS */
|
||||||
|
|
||||||
|
sp = only_one ? one_format : many_format;
|
||||||
|
|
||||||
|
if (only_one)
|
||||||
|
source = panel_get_file (panel, src_stat);
|
||||||
|
|
||||||
|
while (*sp)
|
||||||
|
{
|
||||||
|
switch (*sp)
|
||||||
|
{
|
||||||
|
case '%':
|
||||||
|
cp = NULL;
|
||||||
|
switch (sp[1])
|
||||||
|
{
|
||||||
|
case 'o':
|
||||||
|
cp = op_names1 [operation] + 1;
|
||||||
|
break;
|
||||||
|
case 'm':
|
||||||
|
cp = operation == OP_DELETE ? "?" : prompt_parts [5];
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
if (only_one)
|
||||||
|
{
|
||||||
|
cp = S_ISDIR (src_stat->st_mode) ?
|
||||||
|
prompt_parts [2] : prompt_parts [0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cp = (panel->marked == panel->dirs_marked)
|
||||||
|
? prompt_parts [3]
|
||||||
|
: (panel->dirs_marked ? prompt_parts [4]
|
||||||
|
: prompt_parts [1]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
*dp++ = *sp++;
|
||||||
|
}
|
||||||
|
if (cp)
|
||||||
|
{
|
||||||
|
sp += 2;
|
||||||
|
while (*cp)
|
||||||
|
*dp++ = *cp++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
*dp++ = *sp++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*dp = '\0';
|
||||||
|
|
||||||
|
if (only_one)
|
||||||
|
{
|
||||||
|
i = fmd_xlen - strlen(format_string) - 4;
|
||||||
|
sprintf (cmd_buf, format_string, name_trunc (source, i));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf (cmd_buf, format_string, panel->marked);
|
||||||
|
i = strlen (cmd_buf) + 6 - fmd_xlen;
|
||||||
|
if (i > 0)
|
||||||
|
{
|
||||||
|
fmd_xlen += i;
|
||||||
|
fmd_init_i18n(); /* to recalculate positions of child widgets */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
131
src/filegui.c
131
src/filegui.c
@ -692,7 +692,7 @@ file_progress_set_stalled_label (char *stalled_msg)
|
|||||||
|
|
||||||
#define FMDY 13
|
#define FMDY 13
|
||||||
#define FMD_XLEN 64
|
#define FMD_XLEN 64
|
||||||
static int fmd_xlen = FMD_XLEN, fmd_i18n_flag = 0;
|
extern int fmd_xlen, fmd_i18n_flag;
|
||||||
static QuickWidget fmd_widgets [] = {
|
static QuickWidget fmd_widgets [] = {
|
||||||
|
|
||||||
#define FMCB0 FMDC
|
#define FMCB0 FMDC
|
||||||
@ -749,7 +749,7 @@ static QuickWidget fmd_widgets [] = {
|
|||||||
&dive_into_subdirs, 0, XV_WLAY_BELOWOF, "dive" },
|
&dive_into_subdirs, 0, XV_WLAY_BELOWOF, "dive" },
|
||||||
{ 0 } };
|
{ 0 } };
|
||||||
|
|
||||||
static void
|
void
|
||||||
fmd_init_i18n()
|
fmd_init_i18n()
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_NLS
|
#ifdef ENABLE_NLS
|
||||||
@ -924,130 +924,3 @@ ask_file_mask:
|
|||||||
*do_background = 1;
|
*do_background = 1;
|
||||||
return dest_dir;
|
return dest_dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* This array introduced to avoid translation problems. The former (op_names)
|
|
||||||
* is assumed to be nouns, suitable in dialog box titles; this one should
|
|
||||||
* contain whatever is used in prompt itself (i.e. in russian, it's verb).
|
|
||||||
* Notice first symbol - it is to fool gettext and force these strings to
|
|
||||||
* be different for it. First symbol is skipped while building a prompt.
|
|
||||||
* (I don't use spaces around the words, because someday they could be
|
|
||||||
* dropped, when widgets get smarter)
|
|
||||||
*/
|
|
||||||
static char *op_names1 [] = { N_("1Copy"), N_("1Move"), N_("1Delete") };
|
|
||||||
|
|
||||||
/*
|
|
||||||
* These are formats for building a prompt. Parts encoded as follows:
|
|
||||||
* %o - operation from op_names1
|
|
||||||
* %f - file/files or files/directories, as appropriate
|
|
||||||
* %m - "with source mask" or question mark for delete
|
|
||||||
* %s - source name (truncated)
|
|
||||||
* %d - number of marked files
|
|
||||||
*/
|
|
||||||
static char* one_format = N_("%o %f \"%s\"%m");
|
|
||||||
static char* many_format = N_("%o %d %f%m");
|
|
||||||
|
|
||||||
static char* prompt_parts [] =
|
|
||||||
{
|
|
||||||
N_("file"), N_("files"), N_("directory"), N_("directories"),
|
|
||||||
N_("files/directories"), N_(" with source mask:")
|
|
||||||
};
|
|
||||||
|
|
||||||
char*
|
|
||||||
panel_operate_generate_prompt (char* cmd_buf, WPanel* panel, int operation, int only_one,
|
|
||||||
struct stat* src_stat)
|
|
||||||
{
|
|
||||||
register char *sp, *cp;
|
|
||||||
register int i;
|
|
||||||
char format_string [200];
|
|
||||||
char *dp = format_string;
|
|
||||||
char* source = NULL;
|
|
||||||
|
|
||||||
#ifdef ENABLE_NLS
|
|
||||||
static int i18n_flag = 0;
|
|
||||||
if (!i18n_flag)
|
|
||||||
{
|
|
||||||
if (!fmd_i18n_flag)
|
|
||||||
fmd_init_i18n(); /* to get proper fmd_xlen */
|
|
||||||
|
|
||||||
for (i = sizeof (op_names1) / sizeof (op_names1 [0]); i--;)
|
|
||||||
op_names1 [i] = _(op_names1 [i]);
|
|
||||||
|
|
||||||
for (i = sizeof (prompt_parts) / sizeof (prompt_parts [0]); i--;)
|
|
||||||
prompt_parts [i] = _(prompt_parts [i]);
|
|
||||||
|
|
||||||
one_format = _(one_format);
|
|
||||||
many_format = _(many_format);
|
|
||||||
i18n_flag = 1;
|
|
||||||
}
|
|
||||||
#endif /* ENABLE_NLS */
|
|
||||||
|
|
||||||
sp = only_one ? one_format : many_format;
|
|
||||||
|
|
||||||
if (only_one)
|
|
||||||
source = panel_get_file (panel, src_stat);
|
|
||||||
|
|
||||||
while (*sp)
|
|
||||||
{
|
|
||||||
switch (*sp)
|
|
||||||
{
|
|
||||||
case '%':
|
|
||||||
cp = NULL;
|
|
||||||
switch (sp[1])
|
|
||||||
{
|
|
||||||
case 'o':
|
|
||||||
cp = op_names1 [operation] + 1;
|
|
||||||
break;
|
|
||||||
case 'm':
|
|
||||||
cp = operation == OP_DELETE ? "?" : prompt_parts [5];
|
|
||||||
break;
|
|
||||||
case 'f':
|
|
||||||
if (only_one)
|
|
||||||
{
|
|
||||||
cp = S_ISDIR (src_stat->st_mode) ?
|
|
||||||
prompt_parts [2] : prompt_parts [0];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cp = (panel->marked == panel->dirs_marked)
|
|
||||||
? prompt_parts [3]
|
|
||||||
: (panel->dirs_marked ? prompt_parts [4]
|
|
||||||
: prompt_parts [1]);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
*dp++ = *sp++;
|
|
||||||
}
|
|
||||||
if (cp)
|
|
||||||
{
|
|
||||||
sp += 2;
|
|
||||||
while (*cp)
|
|
||||||
*dp++ = *cp++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
*dp++ = *sp++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*dp = '\0';
|
|
||||||
|
|
||||||
if (only_one)
|
|
||||||
{
|
|
||||||
i = fmd_xlen - strlen(format_string) - 4;
|
|
||||||
sprintf (cmd_buf, format_string, name_trunc (source, i));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sprintf (cmd_buf, format_string, panel->marked);
|
|
||||||
i = strlen (cmd_buf) + 6 - fmd_xlen;
|
|
||||||
if (i > 0)
|
|
||||||
{
|
|
||||||
fmd_xlen += i;
|
|
||||||
fmd_init_i18n(); /* to recalculate positions of child widgets */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return source;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ FileProgressStatus file_progress_real_query_replace (enum OperationMode mode,
|
|||||||
struct stat *_d_stat);
|
struct stat *_d_stat);
|
||||||
|
|
||||||
void file_progress_set_stalled_label (char *stalled_msg);
|
void file_progress_set_stalled_label (char *stalled_msg);
|
||||||
|
void fmd_init_i18n();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Shared variables used to pass information from the file.c module to
|
* Shared variables used to pass information from the file.c module to
|
||||||
|
Loading…
Reference in New Issue
Block a user