mozilla-nongnome-proxies.patch
changeset 650 e8c83b144fd1
parent 568 2c74c5927ea2
child 686 ab25aac2aa83
equal deleted inserted replaced
649:de1740022f78 650:e8c83b144fd1
     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 @@ -50,22 +50,28 @@ nsUnixSystemProxySettings::GetMainThread
    12 @@ -50,24 +50,28 @@ nsUnixSystemProxySettings::GetMainThread
    13    // dbus prevents us from being threadsafe, but this routine should not block anyhow
    13    // dbus prevents us from being threadsafe, but this routine should not block anyhow
    14    *aMainThreadOnly = true;
    14    *aMainThreadOnly = true;
    15    return NS_OK;
    15    return NS_OK;
    16  }
    16  }
    17  
    17  
    18  nsresult
    18  nsresult
    19  nsUnixSystemProxySettings::Init()
    19  nsUnixSystemProxySettings::Init()
    20  {
    20  {
    21 -  mSchemeProxySettings.Init(5);
    21 -  mSchemeProxySettings.Init(5);
    22 -  mGConf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
       
    23 -  mGSettings = do_GetService(NS_GSETTINGSSERVICE_CONTRACTID);
    22 -  mGSettings = do_GetService(NS_GSETTINGSSERVICE_CONTRACTID);
    24 -  if (mGSettings) {
    23 -  if (mGSettings) {
    25 -    mGSettings->GetCollectionForSchema(NS_LITERAL_CSTRING("org.gnome.system.proxy"),
    24 -    mGSettings->GetCollectionForSchema(NS_LITERAL_CSTRING("org.gnome.system.proxy"),
    26 -                                       getter_AddRefs(mProxySettings));
    25 -                                       getter_AddRefs(mProxySettings));
    27 +  // If this is a GNOME session, load gconf and try to use its preferences.
    26 -  }
    28 +  // If gconf is not available (which would be stupid) we'll proceed as if
    27 -  if (!mProxySettings) {
    29 +  // this was not a GNOME session, using *_PROXY environment variables.
    28 -    mGConf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
       
    29 +  // only use GSettings if that is a GNOME session
    30 +  const char* sessionType = PR_GetEnv("DESKTOP_SESSION");
    30 +  const char* sessionType = PR_GetEnv("DESKTOP_SESSION");
    31 +  if (sessionType && !strcmp(sessionType, "gnome")) {
    31 +  if (sessionType && !strcmp(sessionType, "gnome")) {
    32 +    mSchemeProxySettings.Init(5);
    32 +    mSchemeProxySettings.Init(5);
    33 +    mGConf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
       
    34 +    mGSettings = do_GetService(NS_GSETTINGSSERVICE_CONTRACTID);
    33 +    mGSettings = do_GetService(NS_GSETTINGSSERVICE_CONTRACTID);
    35 +    if (mGSettings) {
    34 +    if (mGSettings) {
    36 +      mGSettings->GetCollectionForSchema(NS_LITERAL_CSTRING("org.gnome.system.proxy"),
    35 +      mGSettings->GetCollectionForSchema(NS_LITERAL_CSTRING("org.gnome.system.proxy"),
    37 +                                         getter_AddRefs(mProxySettings));
    36 +                                         getter_AddRefs(mProxySettings));
    38 +    }
    37 +    }
       
    38 +    if (!mProxySettings) {
       
    39 +      mGConf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
       
    40 +    }
    39    }
    41    }
    40  
    42    
    41    return NS_OK;
    43    return NS_OK;
    42  }
    44  }
    43  
    45  
    44  bool
    46  bool
    45  nsUnixSystemProxySettings::IsProxyMode(const char* aMode)
    47  nsUnixSystemProxySettings::IsProxyMode(const char* aMode)