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 @@ -55,24 +55,27 @@ NS_IMETHODIMP |
12 @@ -57,25 +57,27 @@ NS_IMETHODIMP |
13 nsUnixSystemProxySettings::GetMainThreadOnly(bool* aMainThreadOnly) { |
13 nsUnixSystemProxySettings::GetMainThreadOnly(bool* aMainThreadOnly) { |
14 // dbus prevents us from being threadsafe, but this routine should not block |
14 // dbus prevents us from being threadsafe, but this routine should not block |
15 // anyhow |
15 // anyhow |
16 *aMainThreadOnly = true; |
16 *aMainThreadOnly = true; |
17 return NS_OK; |
17 return NS_OK; |
18 } |
18 } |
19 |
19 |
20 nsresult nsUnixSystemProxySettings::Init() { |
20 void nsUnixSystemProxySettings::Init() { |
21 - mGSettings = do_GetService(NS_GSETTINGSSERVICE_CONTRACTID); |
21 - mGSettings = do_GetService(NS_GSETTINGSSERVICE_CONTRACTID); |
22 - if (mGSettings) { |
22 - if (mGSettings) { |
23 - mGSettings->GetCollectionForSchema( |
23 - mGSettings->GetCollectionForSchema( |
24 - NS_LITERAL_CSTRING("org.gnome.system.proxy"), |
24 - NS_LITERAL_CSTRING("org.gnome.system.proxy"), |
25 - getter_AddRefs(mProxySettings)); |
25 - getter_AddRefs(mProxySettings)); |
26 - } |
26 - } |
27 - if (!mProxySettings) { |
27 - if (!mProxySettings) { |
28 - mGConf = do_GetService(NS_GCONFSERVICE_CONTRACTID); |
28 - mGConf = do_GetService(NS_GCONFSERVICE_CONTRACTID); |
|
29 - } |
29 + // only use GSettings if that is a GNOME session |
30 + // only use GSettings if that is a GNOME session |
30 + const char* sessionType = PR_GetEnv("DESKTOP_SESSION"); |
31 + const char* sessionType = PR_GetEnv("DESKTOP_SESSION"); |
31 + if (sessionType && !strcmp(sessionType, "gnome")) { |
32 + if (sessionType && !strcmp(sessionType, "gnome")) { |
32 + mGSettings = do_GetService(NS_GSETTINGSSERVICE_CONTRACTID); |
33 + mGSettings = do_GetService(NS_GSETTINGSSERVICE_CONTRACTID); |
33 + if (mGSettings) { |
34 + if (mGSettings) { |
35 + getter_AddRefs(mProxySettings)); |
36 + getter_AddRefs(mProxySettings)); |
36 + } |
37 + } |
37 + if (!mProxySettings) { |
38 + if (!mProxySettings) { |
38 + mGConf = do_GetService(NS_GCONFSERVICE_CONTRACTID); |
39 + mGConf = do_GetService(NS_GCONFSERVICE_CONTRACTID); |
39 + } |
40 + } |
40 } |
|
41 |
|
42 return NS_OK; |
|
43 } |
41 } |
44 |
42 |
45 bool nsUnixSystemProxySettings::IsProxyMode(const char* aMode) { |
43 bool nsUnixSystemProxySettings::IsProxyMode(const char* aMode) { |
46 nsAutoCString mode; |
44 nsAutoCString mode; |
47 return NS_SUCCEEDED(mGConf->GetString( |
45 return NS_SUCCEEDED(mGConf->GetString( |
|
46 NS_LITERAL_CSTRING("/system/proxy/mode"), mode)) && |
|
47 mode.EqualsASCII(aMode); |
|
48 } |