mshtml: Added AcceptLanguage handling.
This commit is contained in:
parent
57b876dd0d
commit
a3717bff18
|
@ -45,6 +45,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
|||
#define NS_EDITORCONTROLLER_CONTRACTID "@mozilla.org/editor/editorcontroller;1"
|
||||
#define NS_ARRAY_CONTRACTID "@mozilla.org/array;1"
|
||||
#define NS_VARIANT_CONTRACTID "@mozilla.org/variant;1"
|
||||
#define NS_PREFERENCES_CONTRACTID "@mozilla.org/preferences;1"
|
||||
|
||||
#define APPSTARTUP_TOPIC "app-startup"
|
||||
|
||||
|
@ -253,8 +254,39 @@ static BOOL load_wine_gecko(PRUnichar *gre_path)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void set_lang(nsIPrefBranch *pref)
|
||||
{
|
||||
char langs[100];
|
||||
DWORD res, size, type;
|
||||
HKEY hkey;
|
||||
nsresult nsres;
|
||||
|
||||
static const WCHAR international_keyW[] =
|
||||
{'S','o','f','t','w','a','r','e',
|
||||
'\\','M','i','c','r','o','s','o','f','t',
|
||||
'\\','I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r',
|
||||
'\\','I','n','t','e','r','n','a','t','i','o','n','a','l',0};
|
||||
|
||||
res = RegOpenKeyW(HKEY_CURRENT_USER, international_keyW, &hkey);
|
||||
if(res != ERROR_SUCCESS)
|
||||
return;
|
||||
|
||||
size = sizeof(langs);
|
||||
res = RegQueryValueExA(hkey, "AcceptLanguage", 0, &type, (LPBYTE)langs, &size);
|
||||
RegCloseKey(hkey);
|
||||
if(res != ERROR_SUCCESS || type != REG_SZ)
|
||||
return;
|
||||
|
||||
TRACE("Setting lang %s\n", debugstr_a(langs));
|
||||
|
||||
nsres = nsIPrefBranch_SetCharPref(pref, "intl.accept_languages", langs);
|
||||
if(NS_FAILED(nsres))
|
||||
ERR("SetCharPref failed: %08x\n", nsres);
|
||||
}
|
||||
|
||||
static void set_profile(void)
|
||||
{
|
||||
nsIPrefBranch *pref;
|
||||
nsIProfile *profile;
|
||||
PRBool exists = FALSE;
|
||||
nsresult nsres;
|
||||
|
@ -280,6 +312,17 @@ static void set_profile(void)
|
|||
ERR("SetCurrentProfile failed: %08x\n", nsres);
|
||||
|
||||
nsIProfile_Release(profile);
|
||||
|
||||
nsres = nsIServiceManager_GetServiceByContractID(pServMgr, NS_PREFERENCES_CONTRACTID,
|
||||
&IID_nsIPrefBranch, (void**)&pref);
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("Could not get preference service: %08x\n", nsres);
|
||||
return;
|
||||
}
|
||||
|
||||
set_lang(pref);
|
||||
|
||||
nsIPrefBranch_Release(pref);
|
||||
}
|
||||
|
||||
static BOOL init_xpcom(const PRUnichar *gre_path)
|
||||
|
|
|
@ -1504,6 +1504,33 @@ interface nsIFile : nsISupports
|
|||
nsresult GetDirectoryEntries(nsISimpleEnumerator **aDirectoryEntries);
|
||||
}
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(56c35506-f14b-11d3-99d3-ddbfac2ccf65)
|
||||
/* FROZEN */
|
||||
]
|
||||
interface nsIPrefBranch : nsISupports
|
||||
{
|
||||
nsresult GetRoot(char **aRoot);
|
||||
nsresult GetPrefType(const char *aPrefName, PRInt32 *_retval);
|
||||
nsresult GetBoolPref(const char *aPrefName, PRBool *_retval);
|
||||
nsresult SetBoolPref(const char *aPrefName, PRInt32 aValue);
|
||||
nsresult GetCharPref(const char *aPrefName, char **_retval);
|
||||
nsresult SetCharPref(const char *aPrefName, const char *aValue);
|
||||
nsresult GetIntPref(const char *aPrefName, PRInt32 *_retval);
|
||||
nsresult SetIntPref(const char *aPrefName, PRInt32 aValue);
|
||||
nsresult GetComplexValue(const char *aPrefName, const nsIID *aType, void **aValue);
|
||||
nsresult SetComplexValue(const char *aPrefName, const nsIID *aType, nsISupports *aValue);
|
||||
nsresult ClearUserPref(const char *aPrefName);
|
||||
nsresult LockPref(const char *aPrefName);
|
||||
nsresult PrefHasUserValue(const char *aPrefName, PRBool *_retval);
|
||||
nsresult PrefIsLocked(const char *aPrefName, PRBool *_retval);
|
||||
nsresult UnlockPref(const char *aPrefName);
|
||||
nsresult DeleteBranch(const char *aStartingAt);
|
||||
nsresult GetChildList(const char *aStartingAt, PRUint32 *aCount, char ***aChildArray);
|
||||
nsresult ResetBranch(const char *aStartingAt);
|
||||
}
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(15fd6940-8ea7-11d3-93ad-00104ba0fd40)
|
||||
|
|
Loading…
Reference in New Issue