author | Wolfgang Rosenauer <wr@rosenauer.org> |
Wed, 08 Feb 2012 08:34:20 +0100 | |
changeset 382 | 67f876aafae8 |
parent 367 | 3fabd9f66322 |
child 419 | f6b055dd94bc |
permissions | -rw-r--r-- |
0 | 1 |
From: Wolfgang Rosenauer |
2 |
Subject: Do not use gconf for proxy settings if not running within Gnome |
|
3 |
||
4 |
Index: toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp |
|
5 |
=================================================================== |
|
6 |
RCS file: /cvsroot/mozilla/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp,v |
|
7 |
retrieving revision 1.1 |
|
367 | 8 |
|
9 |
diff --git a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp |
|
10 |
--- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp |
|
11 |
+++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp |
|
382
67f876aafae8
lift up to Gecko 11beta
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
367
diff
changeset
|
12 |
@@ -71,18 +71,24 @@ private: |
67f876aafae8
lift up to Gecko 11beta
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
367
diff
changeset
|
13 |
nsresult SetProxyResultFromGSettings(const char* aKeyBase, const char* aType, nsACString& aResult); |
367 | 14 |
}; |
0 | 15 |
|
16 |
NS_IMPL_ISUPPORTS1(nsUnixSystemProxySettings, nsISystemProxySettings) |
|
17 |
||
18 |
nsresult |
|
19 |
nsUnixSystemProxySettings::Init() |
|
20 |
{ |
|
382
67f876aafae8
lift up to Gecko 11beta
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
367
diff
changeset
|
21 |
- mGConf = do_GetService(NS_GCONFSERVICE_CONTRACTID); |
67f876aafae8
lift up to Gecko 11beta
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
367
diff
changeset
|
22 |
- mGSettings = do_GetService(NS_GSETTINGSSERVICE_CONTRACTID); |
0 | 23 |
+ // If this is a GNOME session, load gconf and try to use its preferences. |
24 |
+ // If gconf is not available (which would be stupid) we'll proceed as if |
|
25 |
+ // this was not a GNOME session, using *_PROXY environment variables. |
|
26 |
+ const char* sessionType = PR_GetEnv("DESKTOP_SESSION"); |
|
27 |
+ if (sessionType && !strcmp(sessionType, "gnome")) { |
|
28 |
+ mGConf = do_GetService(NS_GCONFSERVICE_CONTRACTID); |
|
382
67f876aafae8
lift up to Gecko 11beta
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
367
diff
changeset
|
29 |
+ mGSettings = do_GetService(NS_GSETTINGSSERVICE_CONTRACTID); |
0 | 30 |
+ } |
31 |
return NS_OK; |
|
32 |
} |
|
33 |
||
367 | 34 |
bool |
0 | 35 |
nsUnixSystemProxySettings::IsProxyMode(const char* aMode) |
36 |
{ |
|
367 | 37 |
nsCAutoString mode; |
38 |
return NS_SUCCEEDED(mGConf->GetString(NS_LITERAL_CSTRING("/system/proxy/mode"), mode)) && |