diff options
author | Caolán McNamara <caolanm@redhat.com> | 2010-10-18 15:42:48 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2010-10-18 15:42:48 +0100 |
commit | 34f1c06830ae530bea4f11aca91e2836a53fd764 (patch) | |
tree | e5511625119420cff7083c26466af559802c1d23 | |
parent | a8e4476824a8ad0be01b4116a00cd48c145961bb (diff) |
#i112656# add osl_setEnvironment and osl_clearEnvironment
-rw-r--r-- | connectivity/source/drivers/adabas/BDriver.cxx | 6 | ||||
-rw-r--r-- | fpicker/source/unx/gnome/SalGtkFilePicker.cxx | 39 | ||||
-rw-r--r-- | fpicker/source/unx/gnome/SalGtkFolderPicker.cxx | 3 | ||||
-rw-r--r-- | fpicker/source/unx/gnome/SalGtkPicker.cxx | 41 | ||||
-rw-r--r-- | fpicker/source/unx/gnome/SalGtkPicker.hxx | 2 | ||||
-rw-r--r-- | svx/source/gengal/gengal.cxx | 5 |
6 files changed, 53 insertions, 43 deletions
diff --git a/connectivity/source/drivers/adabas/BDriver.cxx b/connectivity/source/drivers/adabas/BDriver.cxx index e2af8de0199e..e42b405f7cb6 100644 --- a/connectivity/source/drivers/adabas/BDriver.cxx +++ b/connectivity/source/drivers/adabas/BDriver.cxx @@ -466,8 +466,10 @@ void SAL_CALL ODriver::createCatalog( const Sequence< PropertyValue >& info ) th { TDatabaseStruct aDBInfo; fillInfo(info,aDBInfo); - static char envName[] = "DBSERVICE=0"; - putenv( envName ); + + ::rtl::OUString envVar(RTL_CONSTASCII_USTRINGPARAM("DBSERVICE")); + ::rtl::OUString envData(RTL_CONSTASCII_USTRINGPARAM("0")); + osl_setEnvironment(envVar.pData, envData.pData); m_sDbRunDir = m_sDbWorkURL + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/wrk/")) + aDBInfo.sDBName; String sTemp; diff --git a/fpicker/source/unx/gnome/SalGtkFilePicker.cxx b/fpicker/source/unx/gnome/SalGtkFilePicker.cxx index 8ec76d61d22b..dade4572ae4c 100644 --- a/fpicker/source/unx/gnome/SalGtkFilePicker.cxx +++ b/fpicker/source/unx/gnome/SalGtkFilePicker.cxx @@ -40,13 +40,13 @@ //------------------------------------------------------------------------ #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> #include <cppuhelper/interfacecontainer.h> #include <osl/diagnose.h> +#include <osl/process.h> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> #include <com/sun/star/ui/dialogs/ControlActions.hpp> #include <com/sun/star/uno/Any.hxx> @@ -132,41 +132,8 @@ void SalGtkFilePicker::InitialMapping() gtk_widget_set_size_request (m_pPreview, -1, -1); } -static void lcl_setGTKLanguage(const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr) -{ - static bool bSet = false; - if (bSet) - return; - - OUString sUILocale; - try - { - uno::Reference<lang::XMultiServiceFactory> xConfigMgr = - uno::Reference<lang::XMultiServiceFactory>(xServiceMgr->createInstance( - OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider")), - UNO_QUERY_THROW ); - - Sequence< Any > theArgs(1); - theArgs[ 0 ] <<= OUString::createFromAscii("org.openoffice.Office.Linguistic/General"); - - uno::Reference< container::XNameAccess > xNameAccess = - uno::Reference< container::XNameAccess >(xConfigMgr->createInstanceWithArguments( - OUString::createFromAscii("com.sun.star.configuration.ConfigurationAccess"), theArgs ), - UNO_QUERY_THROW ); - - if (xNameAccess.is()) - xNameAccess->getByName(OUString::createFromAscii("UILocale")) >>= sUILocale; - } catch (...) {} - - if (sUILocale.getLength()) - { - sUILocale = rtl::OUString::createFromAscii("LANGUAGE=") + sUILocale.replace('-', '_'); - putenv(strdup(rtl::OUStringToOString(sUILocale, osl_getThreadTextEncoding()).getStr())); - } - bSet = true; -} - SalGtkFilePicker::SalGtkFilePicker( const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr ) : + SalGtkPicker(xServiceMgr), cppu::WeakComponentImplHelper10< XFilterManager, XFilterGroupManager, @@ -191,8 +158,6 @@ SalGtkFilePicker::SalGtkFilePicker( const uno::Reference<lang::XMultiServiceFact m_PreviewImageWidth( 256 ), m_PreviewImageHeight( 256 ) { - lcl_setGTKLanguage(xServiceMgr); - int i; for( i = 0; i < TOGGLE_LAST; i++ ) diff --git a/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx b/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx index 7e37d00838f4..306f32c95579 100644 --- a/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx +++ b/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx @@ -89,7 +89,8 @@ namespace // constructor //----------------------------------------------------------------------------------------- SalGtkFolderPicker::SalGtkFolderPicker( const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr ) : - m_xServiceMgr( xServiceMgr ) + SalGtkPicker(xServiceMgr), + m_xServiceMgr(xServiceMgr) { CResourceProvider aResProvider; diff --git a/fpicker/source/unx/gnome/SalGtkPicker.cxx b/fpicker/source/unx/gnome/SalGtkPicker.cxx index 64ca96c90c50..4ffb60e594a5 100644 --- a/fpicker/source/unx/gnome/SalGtkPicker.cxx +++ b/fpicker/source/unx/gnome/SalGtkPicker.cxx @@ -45,6 +45,7 @@ #include <com/sun/star/awt/XSystemDependentWindowPeer.hpp> #include <com/sun/star/awt/SystemDependentXWindow.hpp> #include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/container/XNameAccess.hpp> #include <comphelper/processfactory.hxx> #include <cppuhelper/interfacecontainer.h> #include <rtl/process.h> @@ -209,6 +210,46 @@ gint RunDialog::run() return nStatus; } +static void lcl_setGTKLanguage(const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr) +{ + static bool bSet = false; + if (bSet) + return; + + OUString sUILocale; + try + { + uno::Reference<lang::XMultiServiceFactory> xConfigMgr = + uno::Reference<lang::XMultiServiceFactory>(xServiceMgr->createInstance( + OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider")), + UNO_QUERY_THROW ); + + Sequence< Any > theArgs(1); + theArgs[ 0 ] <<= OUString::createFromAscii("org.openoffice.Office.Linguistic/General"); + + uno::Reference< container::XNameAccess > xNameAccess = + uno::Reference< container::XNameAccess >(xConfigMgr->createInstanceWithArguments( + OUString::createFromAscii("com.sun.star.configuration.ConfigurationAccess"), theArgs ), + UNO_QUERY_THROW ); + + if (xNameAccess.is()) + xNameAccess->getByName(OUString::createFromAscii("UILocale")) >>= sUILocale; + } catch (...) {} + + if (sUILocale.getLength()) + { + sUILocale = sUILocale.replace('-', '_'); + rtl::OUString envVar(RTL_CONSTASCII_USTRINGPARAM("LANGUAGE")); + osl_setEnvironment(envVar.pData, sUILocale.pData); + } + bSet = true; +} + +SalGtkPicker::SalGtkPicker(const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr) : m_pDialog(0) +{ + lcl_setGTKLanguage(xServiceMgr); +} + SalGtkPicker::~SalGtkPicker() { if (m_pDialog) diff --git a/fpicker/source/unx/gnome/SalGtkPicker.hxx b/fpicker/source/unx/gnome/SalGtkPicker.hxx index 6349d3ed4988..94e7a11de99a 100644 --- a/fpicker/source/unx/gnome/SalGtkPicker.hxx +++ b/fpicker/source/unx/gnome/SalGtkPicker.hxx @@ -53,7 +53,7 @@ class SalGtkPicker { public: - SalGtkPicker() : m_pDialog(0) {} + SalGtkPicker(const ::com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory>& xServiceMgr); virtual ~SalGtkPicker(); protected: osl::Mutex m_rbHelperMtx; diff --git a/svx/source/gengal/gengal.cxx b/svx/source/gengal/gengal.cxx index 0f2bf53338e8..856ed4742a04 100644 --- a/svx/source/gengal/gengal.cxx +++ b/svx/source/gengal/gengal.cxx @@ -242,8 +242,9 @@ void GalApp::Init() #endif rtl::OUString baseBinDir = fileName.copy( 0, lastSlash ); rtl::OUString installPrefix = baseBinDir + rtl::OUString::createFromAscii( "/../.." ); - rtl::OUString assignment = rtl::OUString::createFromAscii( "OOO_INSTALL_PREFIX=" ) + installPrefix; - putenv( strdup( OUSTRING_CSTR( assignment ))); + + rtl::OUString envVar(RTL_CONSTASCII_USTRINGPARAM("OOO_INSTALL_PREFIX")); + osl_setEnvironment(envVar.pData, installPrefix.pData); } OSL_TRACE( "OOO_INSTALL_PREFIX=%s", getenv( "OOO_INSTALL_PREFIX" ) ); |