Change option to get accepted languages from Locale into a checkbox so it updates at

startup

svn path=/trunk/netsurf/; revision=12787
This commit is contained in:
Chris Young 2011-09-11 14:53:33 +00:00
parent b3bf57ed79
commit f5d91344b7
3 changed files with 27 additions and 9 deletions

View File

@ -329,7 +329,8 @@ void ami_set_options(void)
option_cairo_renderer = 0;
#endif
if((!option_accept_language) || (option_accept_language[0] == '\0'))
if((!option_accept_language) || (option_accept_language[0] == '\0') ||
(option_accept_lang_locale == true))
{
if(tempacceptlangs = ami_locale_langs())
{

View File

@ -375,7 +375,7 @@ void ami_gui_opts_open(void)
ULONG proxytype = 0;
BOOL screenmodedisabled = FALSE, screennamedisabled = FALSE;
BOOL proxyhostdisabled = TRUE, proxyauthdisabled = TRUE;
BOOL disableanims, animspeeddisabled = FALSE;
BOOL disableanims, animspeeddisabled = FALSE, acceptlangdisabled = FALSE;
BOOL scaleselected = option_scale_quality, scaledisabled = FALSE;
BOOL download_notify_disabled = FALSE;
char animspeed[10];
@ -433,6 +433,11 @@ void ami_gui_opts_open(void)
animspeeddisabled = TRUE;
}
if(option_accept_lang_locale)
acceptlangdisabled = TRUE;
else
acceptlangdisabled = FALSE;
if(GfxBase->LibNode.lib_Version < 53)
{
scaledisabled = TRUE;
@ -554,13 +559,15 @@ void ami_gui_opts_open(void)
LAYOUT_AddChild, gow->objects[GID_OPTS_CONTENTLANG] = StringObject,
GA_ID, GID_OPTS_CONTENTLANG,
GA_RelVerify, TRUE,
GA_Disabled, acceptlangdisabled,
STRINGA_TextVal, option_accept_language,
STRINGA_BufferPos,0,
StringEnd,
LAYOUT_AddChild, gow->objects[GID_OPTS_FROMLOCALE] = ButtonObject,
GA_ID,GID_OPTS_FROMLOCALE,
GA_Text,gadlab[GID_OPTS_FROMLOCALE],
GA_RelVerify,TRUE,
LAYOUT_AddChild, gow->objects[GID_OPTS_FROMLOCALE] = CheckBoxObject,
GA_ID, GID_OPTS_FROMLOCALE,
GA_Text, gadlab[GID_OPTS_FROMLOCALE],
GA_RelVerify, TRUE,
GA_Selected, option_accept_lang_locale,
ButtonEnd,
// CHILD_WeightedWidth, 0,
LayoutEnd, // content language
@ -1399,6 +1406,10 @@ void ami_gui_opts_use(void)
if(option_accept_language) free(option_accept_language);
option_accept_language = (char *)strdup((char *)data);
GetAttr(GA_Selected, gow->objects[GID_OPTS_FROMLOCALE],(ULONG *)&data);
if(data) option_accept_lang_locale = true;
else option_accept_lang_locale = false;
GetAttr(GA_Selected,gow->objects[GID_OPTS_HIDEADS],(ULONG *)&data);
if(data) option_block_ads = true;
else option_block_ads = false;
@ -1690,10 +1701,13 @@ BOOL ami_gui_opts_event(void)
break;
case GID_OPTS_FROMLOCALE:
if(text = ami_locale_langs())
RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_CONTENTLANG],
gow->win, NULL, GA_Disabled, code, TAG_DONE);
if(code && (text = ami_locale_langs()))
{
RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_CONTENTLANG],
gow->win,NULL,STRINGA_TextVal, text, TAG_DONE);
gow->win, NULL, STRINGA_TextVal, text, TAG_DONE);
FreeVec(text);
}
break;

View File

@ -66,6 +66,7 @@ extern int option_cairo_renderer;
extern bool option_direct_render;
extern int option_amiga_ydpi;
extern bool option_widescreen;
extern bool option_accept_lang_locale;
#define EXTRA_OPTION_DEFINE \
char *option_url_file = 0; \
@ -114,6 +115,7 @@ int option_cairo_renderer = 1; \
bool option_direct_render = false; \
int option_amiga_ydpi = 72; \
bool option_widescreen = false; \
bool option_accept_lang_locale = true; \
#define EXTRA_OPTION_TABLE \
{ "url_file", OPTION_STRING, &option_url_file }, \
@ -161,5 +163,6 @@ bool option_widescreen = false; \
{ "cairo_renderer", OPTION_INTEGER, &option_cairo_renderer}, \
{ "direct_render", OPTION_BOOL, &option_direct_render}, \
{ "amiga_ydpi", OPTION_INTEGER, &option_amiga_ydpi}, \
{ "widescreen", OPTION_BOOL, &option_widescreen},
{ "widescreen", OPTION_BOOL, &option_widescreen}, \
{ "accept_lang_locale", OPTION_BOOL, &option_accept_lang_locale},
#endif