mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
1999-02-24 Owen Taylor <otaylor@redhat.com>
* fileopctx.h file.c: Moved recursive delete query dialog into gdialogs.c for GNOME. 1999-02-25 Owen Taylor <otaylor@redhat.com> * gdialogs.c (file_delete_query_recursive): GNOME replacement for recursive delete query dialog.
This commit is contained in:
parent
c1d1f5c52f
commit
f197b80587
@ -1,3 +1,8 @@
|
||||
1999-02-25 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdialogs.c (file_delete_query_recursive): GNOME
|
||||
replacement for recursive delete query dialog.
|
||||
|
||||
1999-02-25 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gprefs.c gcustom-layout.[ch]: Add a new page to
|
||||
|
@ -706,6 +706,75 @@ file_mask_dialog (FileOpContext *ctx, FileOperation operation, char *text, char
|
||||
return dest_dir;
|
||||
}
|
||||
|
||||
int
|
||||
file_delete_query_recursive (FileOpContext *ctx, enum OperationMode mode, gchar *s)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *togglebutton;
|
||||
gchar *title;
|
||||
gchar *msg;
|
||||
gint button;
|
||||
gboolean rest_same;
|
||||
|
||||
if (ctx->recursive_result < RECURSIVE_ALWAYS) {
|
||||
msg = g_strdup_printf(_("%s\n\nDirectory not empty. Delete it recursively?"), name_trunc (s, 80));
|
||||
dialog = gnome_message_box_new (msg,
|
||||
GNOME_MESSAGE_BOX_QUESTION,
|
||||
GNOME_STOCK_BUTTON_YES,
|
||||
GNOME_STOCK_BUTTON_NO,
|
||||
GNOME_STOCK_BUTTON_CANCEL,
|
||||
NULL);
|
||||
g_free (msg);
|
||||
|
||||
title = g_strconcat (_(" Delete: "), name_trunc (s, 30), " ", NULL);
|
||||
gtk_window_set_title (GTK_WINDOW (dialog), title);
|
||||
g_free (title);
|
||||
|
||||
togglebutton = gtk_check_button_new_with_label (_("Do the same for the rest"));
|
||||
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox),
|
||||
togglebutton, FALSE, FALSE, 0);
|
||||
gtk_widget_show_all (GNOME_DIALOG (dialog)->vbox);
|
||||
|
||||
gnome_dialog_close_hides (GNOME_DIALOG (dialog), TRUE);
|
||||
|
||||
button = gnome_dialog_run (GNOME_DIALOG (dialog));
|
||||
rest_same = GTK_TOGGLE_BUTTON (togglebutton)->active;
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
|
||||
switch (button) {
|
||||
case 0:
|
||||
ctx->recursive_result = rest_same ? RECURSIVE_ALWAYS : RECURSIVE_YES;
|
||||
break;
|
||||
case 1:
|
||||
ctx->recursive_result = rest_same ? RECURSIVE_NEVER : RECURSIVE_NO;
|
||||
break;
|
||||
case 2:
|
||||
ctx->recursive_result = RECURSIVE_ABORT;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
if (ctx->recursive_result != RECURSIVE_ABORT)
|
||||
do_refresh ();
|
||||
}
|
||||
|
||||
switch (ctx->recursive_result){
|
||||
case RECURSIVE_YES:
|
||||
case RECURSIVE_ALWAYS:
|
||||
return FILE_CONT;
|
||||
|
||||
case RECURSIVE_NO:
|
||||
case RECURSIVE_NEVER:
|
||||
return FILE_SKIP;
|
||||
|
||||
case RECURSIVE_ABORT:
|
||||
|
||||
default:
|
||||
return FILE_ABORT;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
cancel_cb (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
|
@ -1,3 +1,8 @@
|
||||
1999-02-25 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* fileopctx.h file.c: Moved recursive delete query
|
||||
dialog into gdialogs.c for GNOME.
|
||||
|
||||
1999-02-24 Miguel de Icaza <miguel@nuclecu.unam.mx>
|
||||
|
||||
* file.c: Moved FileCopyMode here (thanks to Wolfgang Scherer for
|
||||
|
24
src/file.c
24
src/file.c
@ -156,14 +156,6 @@ char *op_names [3] = {
|
||||
N_(" Delete ")
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
RECURSIVE_YES,
|
||||
RECURSIVE_NO,
|
||||
RECURSIVE_ALWAYS,
|
||||
RECURSIVE_NEVER,
|
||||
RECURSIVE_ABORT
|
||||
} FileCopyMode;
|
||||
|
||||
static int recursive_erase (FileOpContext *ctx, char *s,
|
||||
long *progress_count, double *progress_bytes);
|
||||
|
||||
@ -1749,6 +1741,10 @@ panel_operate_generate_prompt (WPanel* panel, int operation, int only_one,
|
||||
#ifdef HAVE_GNOME
|
||||
extern FileProgressStatus file_progress_query_replace_policy (FileOpContext *ctx,
|
||||
gboolean dialog_needed);
|
||||
extern int file_delete_query_recursive (FileOpContext *ctx,
|
||||
enum OperationMode mode,
|
||||
gchar *s);
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -2180,10 +2176,12 @@ files_error (char *format, char *file1, char *file2)
|
||||
return do_file_error (cmd_buf);
|
||||
}
|
||||
|
||||
#ifndef HAVE_GNOME
|
||||
static int
|
||||
real_query_recursive (FileOpContext *ctx, enum OperationMode mode, char *s)
|
||||
{
|
||||
char *confirm, *text;
|
||||
char *confirm, *textb;
|
||||
gchar *text;
|
||||
|
||||
if (ctx->recursive_result < RECURSIVE_ALWAYS){
|
||||
char *msg =
|
||||
@ -2236,6 +2234,7 @@ real_query_recursive (FileOpContext *ctx, enum OperationMode mode, char *s)
|
||||
return FILE_ABORT;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WITH_BACKGROUND
|
||||
static int
|
||||
@ -2250,10 +2249,17 @@ do_file_error (char *str)
|
||||
static int
|
||||
query_recursive (FileOpContext *ctx, char *s)
|
||||
{
|
||||
#ifdef HAVE_GNOME
|
||||
if (we_are_background)
|
||||
return parent_call (file_delete_query_recursive, ctx, 1, strlen (s), s);
|
||||
else
|
||||
return file_delete_query_recursive (ctx, Foreground, s);
|
||||
#else
|
||||
if (we_are_background)
|
||||
return parent_call (real_query_recursive, ctx, 1, strlen (s), s);
|
||||
else
|
||||
return real_query_recursive (ctx, Foreground, s);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -120,6 +120,14 @@ typedef enum {
|
||||
FILE_ABORT
|
||||
} FileProgressStatus;
|
||||
|
||||
typedef enum {
|
||||
RECURSIVE_YES,
|
||||
RECURSIVE_NO,
|
||||
RECURSIVE_ALWAYS,
|
||||
RECURSIVE_NEVER,
|
||||
RECURSIVE_ABORT
|
||||
} FileCopyMode;
|
||||
|
||||
/* First argument passed to real functions */
|
||||
enum OperationMode {
|
||||
Foreground,
|
||||
|
Loading…
Reference in New Issue
Block a user