7 retrieving revision 1.1 |
7 retrieving revision 1.1 |
8 |
8 |
9 diff --git a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp |
9 diff --git a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp |
10 --- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp |
10 --- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp |
11 +++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp |
11 +++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp |
12 @@ -71,18 +71,24 @@ private: |
12 @@ -74,22 +74,28 @@ private: |
13 nsresult SetProxyResultFromGSettings(const char* aKeyBase, const char* aType, nsACString& aResult); |
13 nsresult SetProxyResultFromGSettings(const char* aKeyBase, const char* aType, nsACString& aResult); |
14 }; |
14 }; |
15 |
15 |
16 NS_IMPL_ISUPPORTS1(nsUnixSystemProxySettings, nsISystemProxySettings) |
16 NS_IMPL_ISUPPORTS1(nsUnixSystemProxySettings, nsISystemProxySettings) |
17 |
17 |
18 nsresult |
18 nsresult |
19 nsUnixSystemProxySettings::Init() |
19 nsUnixSystemProxySettings::Init() |
20 { |
20 { |
|
21 - mSchemeProxySettings.Init(5); |
21 - mGConf = do_GetService(NS_GCONFSERVICE_CONTRACTID); |
22 - mGConf = do_GetService(NS_GCONFSERVICE_CONTRACTID); |
22 - mGSettings = do_GetService(NS_GSETTINGSSERVICE_CONTRACTID); |
23 - mGSettings = do_GetService(NS_GSETTINGSSERVICE_CONTRACTID); |
|
24 - if (mGSettings) { |
|
25 - mGSettings->GetCollectionForSchema(NS_LITERAL_CSTRING("org.gnome.system.proxy"), |
|
26 - getter_AddRefs(mProxySettings)); |
23 + // If this is a GNOME session, load gconf and try to use its preferences. |
27 + // 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 |
28 + // 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. |
29 + // this was not a GNOME session, using *_PROXY environment variables. |
26 + const char* sessionType = PR_GetEnv("DESKTOP_SESSION"); |
30 + const char* sessionType = PR_GetEnv("DESKTOP_SESSION"); |
27 + if (sessionType && !strcmp(sessionType, "gnome")) { |
31 + if (sessionType && !strcmp(sessionType, "gnome")) { |
|
32 + mSchemeProxySettings.Init(5); |
28 + mGConf = do_GetService(NS_GCONFSERVICE_CONTRACTID); |
33 + mGConf = do_GetService(NS_GCONFSERVICE_CONTRACTID); |
29 + mGSettings = do_GetService(NS_GSETTINGSSERVICE_CONTRACTID); |
34 + mGSettings = do_GetService(NS_GSETTINGSSERVICE_CONTRACTID); |
30 + } |
35 + if (mGSettings) { |
|
36 + mGSettings->GetCollectionForSchema(NS_LITERAL_CSTRING("org.gnome.system.proxy"), |
|
37 + getter_AddRefs(mProxySettings)); |
|
38 + } |
|
39 } |
|
40 |
31 return NS_OK; |
41 return NS_OK; |
32 } |
42 } |
33 |
43 |
34 bool |
44 bool |
35 nsUnixSystemProxySettings::IsProxyMode(const char* aMode) |
45 nsUnixSystemProxySettings::IsProxyMode(const char* aMode) |
36 { |
46 { |
37 nsCAutoString mode; |
|
38 return NS_SUCCEEDED(mGConf->GetString(NS_LITERAL_CSTRING("/system/proxy/mode"), mode)) && |
|