void vifm_try_leave(int write_info, int cquit, int force) { if(!force && bg_has_active_jobs()) { if(!prompt_msg("Warning", "Some of backgrounded commands are still " "working. Quit?")) { return; } } fuse_unmount_all(); if(write_info) { write_info_file(); } if(stats_file_choose_action_set()) { vim_write_empty_file_list(); } #ifdef _WIN32 erase(); refresh(); #endif ui_shutdown(); vifm_leave(EXIT_SUCCESS, cquit); }
static int op_remove(ops_t *ops, void *data, const char *src, const char *dst) { if(cfg.confirm && !curr_stats.confirmed && (ops == NULL || !ops->bg)) { curr_stats.confirmed = prompt_msg("Permanent deletion", "Are you sure? If you're undoing a command and want to see file " "names, use :undolist! command"); if(!curr_stats.confirmed) return SKIP_UNDO_REDO_OPERATION; } return op_removesl(ops, data, src, dst); }
/* Runs a Windows executable handling errors and rights elevation. */ static void run_win_executable(char full_path[], int elevate) { int running_error = 0; int running_error_code = NO_ERROR; if(elevate && is_vista_and_above()) { running_error = run_win_executable_as_evaluated(full_path); } else { int returned_exit_code; const int error = win_exec_cmd(full_path, &returned_exit_code); if(error != 0 && !returned_exit_code) { if(error == ERROR_ELEVATION_REQUIRED && is_vista_and_above()) { const int user_response = prompt_msg("Program running error", "Executable requires rights elevation. Run with elevated rights?"); if(user_response != 0) { running_error = run_win_executable_as_evaluated(full_path); } } else { running_error = 1; running_error_code = error; } } update_screen(UT_FULL); } if(running_error) { char err_msg[512]; err_msg[0] = '\0'; if(running_error_code != NO_ERROR && FormatMessageA( FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM, NULL, running_error_code, 0, err_msg, sizeof(err_msg), NULL) == 0) { LOG_WERROR(GetLastError()); } show_error_msgf("Program running error", "Can't run an executable%s%s", (err_msg[0] == '\0') ? "." : ": ", err_msg); } }
int confirm_deletion(int use_trash) { curr_stats.confirmed = 0; if(!use_trash && cfg.confirm) { const int proceed = prompt_msg("Permanent deletion", "Are you sure you want to delete files permanently?"); if(!proceed) { return 0; } curr_stats.confirmed = 1; } return 1; }
int confirm_deletion(int nfiles, int use_trash) { curr_stats.confirmed = 0; if(cfg_confirm_delete(use_trash)) { const char *const title = use_trash ? "Deletion" : "Permanent deletion"; char *const msg = format_str("Are you sure you want to delete %d file%s?", nfiles, (nfiles == 1) ? "" : "s"); const int proceed = prompt_msg(title, msg); free(msg); if(!proceed) { return 0; } curr_stats.confirmed = 1; } return 1; }
static int swap_range(void) { return prompt_msg("Command Error", "Backwards range given, OK to swap?"); }