diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2009-06-21 22:12:52 +0000 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2009-06-21 22:12:52 +0000 |
commit | ec2dba85792ecf9b526083e9c5e2a31828d57254 (patch) | |
tree | f727de5395745f2bd7a3b99531064c5266ca3ced /amiga/gui.c | |
parent | fa976f3aed2c7a1f79462358b14f53335bd08566 (diff) | |
download | netsurf-ec2dba85792ecf9b526083e9c5e2a31828d57254.tar.gz netsurf-ec2dba85792ecf9b526083e9c5e2a31828d57254.tar.bz2 |
Make all the buttons on the first two options tabs work.
May need to improve theme selection so it at least checks it is a valid theme and/or
provide a list of themes instead of a file requester.
Language selection could benefit from also having a drop-down chooser gadget too.
svn path=/trunk/netsurf/; revision=7910
Diffstat (limited to 'amiga/gui.c')
-rwxr-xr-x | amiga/gui.c | 67 |
1 files changed, 46 insertions, 21 deletions
diff --git a/amiga/gui.c b/amiga/gui.c index a36f04541..e52fd721a 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -181,10 +181,48 @@ void ami_switch_tab(struct gui_window_2 *gwin,bool redraw); static void *myrealloc(void *ptr, size_t len, void *pw); void ami_init_layers(struct RastPort *rp); +STRPTR ami_locale_langs(void) +{ + struct Locale *locale; + STRPTR acceptlangs = NULL, acceptlangs2 = NULL; + int i; + + if(locale = OpenLocale(NULL)) + { + for(i=0;i<10;i++) + { + if(locale->loc_PrefLanguages[i]) + { + if(messages_get(locale->loc_PrefLanguages[i]) != locale->loc_PrefLanguages[i]) + { + if(acceptlangs) + { + acceptlangs2 = acceptlangs; + acceptlangs = ASPrintf("%s, %s",acceptlangs2,messages_get(locale->loc_PrefLanguages[i])); + FreeVec(acceptlangs2); + acceptlangs2 = NULL; + } + else + { + acceptlangs = ASPrintf("%s",messages_get(locale->loc_PrefLanguages[i])); + } + } + } + else + { + continue; + } + } + CloseLocale(locale); + } + return acceptlangs; +} + void gui_init(int argc, char** argv) { struct Locale *locale; - char lang[100],throbberfile[100],tempacceptlangs[100] = "\0"; + char lang[100],throbberfile[100]; + STRPTR tempacceptlangs; bool found=FALSE; int i; BPTR lock=0,amiupdatefh; @@ -274,25 +312,6 @@ void gui_init(int argc, char** argv) strcpy(lang,"PROGDIR:Resources/en/Messages"); } - for(i=0;i<10;i++) - { - if(locale->loc_PrefLanguages[i]) - { - if(messages_get(locale->loc_PrefLanguages[i]) != locale->loc_PrefLanguages[i]) - { - if(tempacceptlangs[0] != '\0') - { - strcat(tempacceptlangs,", "); - } - strcat(tempacceptlangs,messages_get(locale->loc_PrefLanguages[i])); - } - } - else - { - continue; - } - } - CloseLocale(locale); messages_load(lang); @@ -311,7 +330,13 @@ void gui_init(int argc, char** argv) css_scrollbar_arrow_colour = 0x00d6d6d6; if((!option_accept_language) || (option_accept_language[0] == '\0')) - option_accept_language = (char *)strdup(tempacceptlangs); + { + if(tempacceptlangs = ami_locale_langs()) + { + option_accept_language = (char *)strdup(tempacceptlangs); + FreeVec(tempacceptlangs); + } + } if((!option_cookie_file) || (option_cookie_file[0] == '\0')) option_cookie_file = (char *)strdup("PROGDIR:Resources/Cookies"); |