Warn when closing multiple tabs

This commit is contained in:
Chris Young 2012-12-08 17:47:57 +00:00
parent ffac64fcea
commit ff333828b7
6 changed files with 22 additions and 4 deletions

View File

@ -390,7 +390,7 @@ gui_window_save_link(struct gui_window *g, const char *url, const char *title)
BOOL ami_download_check_overwrite(const char *file, struct Window *win, ULONG size) BOOL ami_download_check_overwrite(const char *file, struct Window *win, ULONG size)
{ {
/* Return TRUE if file can be (over-)written */ /* Return TRUE if file can be (over-)written */
int res = 0; int32 res = 0;
BPTR lock = 0; BPTR lock = 0;
BPTR fh = 0; BPTR fh = 0;
int64 oldsize = 0; int64 oldsize = 0;

View File

@ -3317,6 +3317,14 @@ void ami_close_all_tabs(struct gui_window_2 *gwin)
struct Node *tab; struct Node *tab;
struct Node *ntab; struct Node *ntab;
if((gwin->tabs > 1) && (nsoption_bool(tab_close_warn) == true)) {
char *req_body = ami_utf8_easy(messages_get("MultiTabClose"));
int32 res = ami_warn_user_multi(req_body, "No", "Yes", gwin->win);
free(req_body);
if(res == 1) return;
}
if(gwin->tabs) if(gwin->tabs)
{ {
tab = GetHead(&gwin->tab_list); tab = GetHead(&gwin->tab_list);

View File

@ -71,7 +71,7 @@ void warn_user(const char *warning, const char *detail)
if(utf8warning) free(utf8warning); if(utf8warning) free(utf8warning);
} }
int ami_warn_user_multi(const char *body, const char *opt1, const char *opt2, struct Window *win) int32 ami_warn_user_multi(const char *body, const char *opt1, const char *opt2, struct Window *win)
{ {
int res = 0; int res = 0;
char *utf8text = ami_utf8_easy(body); char *utf8text = ami_utf8_easy(body);
@ -90,6 +90,8 @@ int ami_warn_user_multi(const char *body, const char *opt1, const char *opt2, st
if(utf8text) free(utf8text); if(utf8text) free(utf8text);
if(utf8gadgets) FreeVec(utf8gadgets); if(utf8gadgets) FreeVec(utf8gadgets);
return res;
} }
void die(const char *error) void die(const char *error)

View File

@ -19,5 +19,5 @@
#ifndef AMIGA_MISC_H #ifndef AMIGA_MISC_H
#define AMIGA_MISC_H #define AMIGA_MISC_H
char *translate_escape_chars(const char *s); char *translate_escape_chars(const char *s);
int ami_warn_user_multi(const char *body, const char *opt1, const char *opt2, struct Window *win); int32 ami_warn_user_multi(const char *body, const char *opt1, const char *opt2, struct Window *win);
#endif #endif

View File

@ -39,6 +39,7 @@
bool use_openurl_lib; \ bool use_openurl_lib; \
bool new_tab_active; \ bool new_tab_active; \
bool new_tab_last; \ bool new_tab_last; \
bool tab_close_warn; \
bool kiosk_mode; \ bool kiosk_mode; \
char *search_engines_file; \ char *search_engines_file; \
char *arexx_dir; \ char *arexx_dir; \
@ -102,6 +103,7 @@
.use_openurl_lib = false, \ .use_openurl_lib = false, \
.new_tab_active = false, \ .new_tab_active = false, \
.new_tab_last = false, \ .new_tab_last = false, \
.tab_close_warn = true, \
.kiosk_mode = false, \ .kiosk_mode = false, \
.search_engines_file = NULL, \ .search_engines_file = NULL, \
.arexx_dir = NULL, \ .arexx_dir = NULL, \
@ -164,6 +166,7 @@
{ "use_openurl_lib", OPTION_BOOL, &nsoptions.use_openurl_lib}, \ { "use_openurl_lib", OPTION_BOOL, &nsoptions.use_openurl_lib}, \
{ "new_tab_is_active", OPTION_BOOL, &nsoptions.new_tab_active}, \ { "new_tab_is_active", OPTION_BOOL, &nsoptions.new_tab_active}, \
{ "new_tab_last", OPTION_BOOL, &nsoptions.new_tab_last}, \ { "new_tab_last", OPTION_BOOL, &nsoptions.new_tab_last}, \
{ "tab_close_warn", OPTION_BOOL, &nsoptions.tab_close_warn}, \
{ "kiosk_mode", OPTION_BOOL, &nsoptions.kiosk_mode}, \ { "kiosk_mode", OPTION_BOOL, &nsoptions.kiosk_mode}, \
{ "search_engines_file",OPTION_STRING, &nsoptions.search_engines_file }, \ { "search_engines_file",OPTION_STRING, &nsoptions.search_engines_file }, \
{ "arexx_dir", OPTION_STRING, &nsoptions.arexx_dir }, \ { "arexx_dir", OPTION_STRING, &nsoptions.arexx_dir }, \

View File

@ -2675,6 +2675,11 @@ de.ami.CompError:Nicht zu öffnen
fr.ami.CompError:Unable to open fr.ami.CompError:Unable to open
it.ami.CompError:Impossibile aprire it.ami.CompError:Impossibile aprire
nl.ami.CompError:Unable to open nl.ami.CompError:Unable to open
en.ami.MultiTabClose:Are you sure you want to close multiple tabs?
de.ami.MultiTabClose:Are you sure you want to close multiple tabs?
fr.ami.MultiTabClose:Are you sure you want to close multiple tabs?
it.ami.MultiTabClose:Are you sure you want to close multiple tabs?
nl.ami.MultiTabClose:Are you sure you want to close multiple tabs?
# Queries # Queries
# ======= # =======