Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delete recursive dialog: move a little down to keep a delete info vis… #80

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions lib/widget/wtools.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@ query_dialog (const char *header, const char *text, int flags, int count, ...)
int i;
int result = -1;
int cols, lines;
int lxx = 0;
int lyy = 0;

const int *query_colors = (flags & D_ERROR) != 0 ? alarm_colors : dialog_colors;
dlg_flags_t dlg_flags = (flags & D_CENTER) != 0 ? (DLG_CENTER | DLG_TRYUP) : DLG_NONE;

Expand All @@ -302,9 +305,16 @@ query_dialog (const char *header, const char *text, int flags, int count, ...)
cols = 6 + max (win_len, max (str_term_width1 (header), cols));
lines += 4 + (count > 0 ? 2 : 0);

if (flags & D_LOWER)
{
lxx = (COLS - cols) / 2;
lyy = (LINES - lines + 8) / 2;
dlg_flags = DLG_NONE;
}

/* prepare dialog */
query_dlg =
dlg_create (TRUE, 0, 0, lines, cols, query_colors, query_default_callback, NULL,
dlg_create (TRUE, lyy, lxx, lines, cols, query_colors, query_default_callback, NULL,
"[QueryBox]", header, dlg_flags);

if (count > 0)
Expand Down Expand Up @@ -336,7 +346,8 @@ query_dialog (const char *header, const char *text, int flags, int count, ...)
va_end (ap);

/* do resize before running and selecting any widget */
send_message (query_dlg, NULL, MSG_RESIZE, 0, NULL);
if ((flags & D_LOWER) == 0)
send_message (query_dlg, NULL, MSG_RESIZE, 0, NULL);

if (defbutton != NULL)
dlg_select_widget (defbutton);
Expand Down
3 changes: 2 additions & 1 deletion lib/widget/wtools.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ enum
{
D_NORMAL = 0,
D_ERROR = (1 << 0),
D_CENTER = (1 << 1)
D_CENTER = (1 << 1),
D_LOWER = (1 << 2)
} /* dialog options */ ;

/*** structures declarations (and typedefs of structures)*****************************************/
Expand Down
4 changes: 2 additions & 2 deletions src/filemanager/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,8 +714,8 @@ real_query_recursive (file_op_context_t * ctx, enum OperationMode mode, const ch
query_set_sel (1);

ctx->recursive_result =
query_dialog (op_names[OP_DELETE], text, D_ERROR, 5, _("&Yes"), _("&No"), _("A&ll"),
_("Non&e"), _("&Abort"));
query_dialog (op_names[OP_DELETE], text, D_ERROR | D_LOWER, 5, _("&Yes"), _("&No"),
_("A&ll"), _("Non&e"), _("&Abort"));
g_free (text);

if (ctx->recursive_result != RECURSIVE_ABORT)
Expand Down