diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2004-09-08 16:08:31 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2004-09-08 16:08:31 +0000 |
commit | 3bc550d0f3d1bb47da5efef89e91b695f10be0dc (patch) | |
tree | 13268870821d712a4f97d27c819386355d064e53 /fpicker | |
parent | INTEGRATION: CWS gtkfpicker1 (1.1.2); FILE ADDED (diff) | |
download | core-3bc550d0f3d1bb47da5efef89e91b695f10be0dc.tar.gz core-3bc550d0f3d1bb47da5efef89e91b695f10be0dc.zip |
INTEGRATION: CWS gtkfpicker1 (1.1.2); FILE ADDED
2004/09/08 09:42:08 cmc 1.1.2.1: #i32555# use system gtk folderpicker like gtk filepicker
Diffstat (limited to 'fpicker')
-rw-r--r-- | fpicker/source/unx/gnome/SalGtkFolderPicker.cxx | 302 | ||||
-rw-r--r-- | fpicker/source/unx/gnome/SalGtkFolderPicker.hxx | 169 | ||||
-rw-r--r-- | fpicker/source/unx/gnome/SalGtkPicker.cxx | 151 |
3 files changed, 622 insertions, 0 deletions
diff --git a/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx b/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx new file mode 100644 index 000000000000..86fb87f6bf94 --- /dev/null +++ b/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx @@ -0,0 +1,302 @@ +/************************************************************************* + * + * $RCSfile: SalGtkFolderPicker.cxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: hr $ $Date: 2004-09-08 17:07:57 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): Anil Bhatia + * + * + ************************************************************************/ + +//------------------------------------------------------------------------ +// includes +//------------------------------------------------------------------------ + +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif +#ifndef _COM_SUN_STAR_UI_DIALOGS_EXECUTABLEDIALOGRESULTS_HPP_ +#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> +#endif +#ifndef _COM_SUN_STAR_UI_DIALOGS_EXTENDEDFILEPICKERELEMENTIDS_HPP_ +#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> +#endif +#ifndef _COM_SUN_STAR_UI_DIALOGS_COMMONFILEPICKERELEMENTIDS_HPP_ +#include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> +#endif +#ifndef _COM_SUN_STAR_UI_DIALOGS_EXTENDEDFILEPICKERELEMENTIDS_HPP_ +#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> +#endif +#ifndef _CPPUHELPER_INTERFACECONTAINER_H_ +#include <cppuhelper/interfacecontainer.h> +#endif +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif +#ifndef _COM_SUN_STAR_UI_DIALOGS_TEMPLATEDESCRIPTION_HPP_ +#include <com/sun/star/ui/dialogs/TemplateDescription.hpp> +#endif +#ifndef _COM_SUN_STAR_UNO_ANY_HXX_ +#include <com/sun/star/uno/Any.hxx> +#endif +#ifndef _FPSERVICEINFO_HXX_ +#include <FPServiceInfo.hxx> +#endif +#ifndef _VOS_MUTEX_HXX_ +#include <vos/mutex.hxx> +#endif +#ifndef _SV_SVAPP_HXX +#include <vcl/svapp.hxx> +#endif +#ifndef _SALGTKFOLDERPICKER_HXX_ +#include "SalGtkFolderPicker.hxx" +#endif + +#include <tools/urlobj.hxx> + +#include <iostream> +#include "resourceprovider.hxx" +#ifndef _SV_RC_H +#include <tools/rc.hxx> +#endif + +//------------------------------------------------------------------------ +// namespace directives +//------------------------------------------------------------------------ + +using namespace ::rtl; +using namespace ::com::sun::star; +using namespace ::com::sun::star::ui::dialogs; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::uno; + +//------------------------------------------------------------------------ +// helper functions +//------------------------------------------------------------------------ + +namespace +{ + // controling event notifications + uno::Sequence<rtl::OUString> SAL_CALL FolderPicker_getSupportedServiceNames() + { + uno::Sequence<rtl::OUString> aRet(3); + aRet[0] = rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.FolderPicker" ); + aRet[1] = rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.SystemFolderPicker" ); + aRet[2] = rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.GtkFolderPicker" ); + return aRet; + } +} + +//----------------------------------------------------------------------------------------- +// constructor +//----------------------------------------------------------------------------------------- +SalGtkFolderPicker::SalGtkFolderPicker( const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr ) : + m_xServiceMgr( xServiceMgr ) +{ + m_pDialog = gtk_file_chooser_dialog_new( "Folder Selection", NULL, + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL ); + + gtk_dialog_set_default_response( GTK_DIALOG (m_pDialog), GTK_RESPONSE_ACCEPT ); + gtk_file_chooser_set_local_only( GTK_FILE_CHOOSER( m_pDialog ), FALSE ); + gtk_file_chooser_set_select_multiple( GTK_FILE_CHOOSER( m_pDialog ), FALSE ); +} + +// ------------------------------------------------- +// XEventListener +// ------------------------------------------------- + +void SAL_CALL SalGtkFolderPicker::disposing( const lang::EventObject& aEvent ) + throw( uno::RuntimeException ) +{ +} + +void SAL_CALL SalGtkFolderPicker::setDisplayDirectory( const rtl::OUString& aDirectory ) + throw( lang::IllegalArgumentException, uno::RuntimeException ) +{ + OSL_ASSERT( m_pDialog != NULL ); + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + + OString aTxt = OUStringToOString( aDirectory, RTL_TEXTENCODING_UTF8 ); + + if( aTxt.lastIndexOf('/') == aTxt.getLength() - 1 ) + aTxt = aTxt.copy( 0, aTxt.getLength() - 1 ); + + OSL_TRACE( "setting path to %s\n", aTxt.getStr() ); + + gtk_file_chooser_set_current_folder_uri( GTK_FILE_CHOOSER( m_pDialog ), + aTxt.getStr() ); +} + +rtl::OUString SAL_CALL SalGtkFolderPicker::getDisplayDirectory() throw( uno::RuntimeException ) +{ + OSL_ASSERT( m_pDialog != NULL ); + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + + gchar* pCurrentFolder = + gtk_file_chooser_get_current_folder_uri( GTK_FILE_CHOOSER( m_pDialog ) ); + ::rtl::OUString aCurrentFolderName = + ::rtl::OUString( const_cast<const sal_Char *>( pCurrentFolder ), + strlen( pCurrentFolder ), RTL_TEXTENCODING_UTF8 ); + g_free( pCurrentFolder ); + + return aCurrentFolderName; +} + +rtl::OUString SAL_CALL SalGtkFolderPicker::getDirectory() throw( uno::RuntimeException ) +{ + return getDisplayDirectory(); +} + +void SAL_CALL SalGtkFolderPicker::setDescription( const rtl::OUString& rDescription ) + throw( uno::RuntimeException ) +{ + ::rtl::OString aDescription = OUStringToOString( rDescription, RTL_TEXTENCODING_UTF8 ); + fprintf(stderr, "desc is %s\n", aDescription.getStr()); +} + + + +//----------------------------------------------------------------------------------------- +// XExecutableDialog functions +//----------------------------------------------------------------------------------------- + +void SAL_CALL SalGtkFolderPicker::setTitle( const rtl::OUString& aTitle ) throw( uno::RuntimeException ) +{ + OSL_ASSERT( m_pDialog != NULL ); + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + + ::rtl::OString aWindowTitle = OUStringToOString( aTitle, RTL_TEXTENCODING_UTF8 ); + gtk_window_set_title( GTK_WINDOW( m_pDialog ), aWindowTitle.getStr() ); + + fprintf(stderr, "title is %s\n", aWindowTitle.getStr()); + +} + +sal_Int16 SAL_CALL SalGtkFolderPicker::execute() throw( uno::RuntimeException ) +{ + OSL_TRACE( "1: HERE WE ARE\n"); + OSL_ASSERT( m_pDialog != NULL ); + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + + sal_Int16 retVal = 0; + + gint nStatus = gtk_dialog_run( GTK_DIALOG( m_pDialog ) ); + gtk_widget_hide( m_pDialog ); + switch( nStatus ) + { + case GTK_RESPONSE_ACCEPT: + retVal = ExecutableDialogResults::OK; + break; + case GTK_RESPONSE_CANCEL: + retVal = ExecutableDialogResults::CANCEL; + break; + default: + retVal = 0; + break; + } + + return retVal; +} + +//------------------------------------------------------------------------------------ +// XCancellable +//------------------------------------------------------------------------------------ + +void SAL_CALL SalGtkFolderPicker::cancel() throw( uno::RuntimeException ) +{ + OSL_ASSERT( m_pDialog != NULL ); + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + + // TODO m_pImpl->cancel(); +} + +// ------------------------------------------------- +// XServiceInfo +// ------------------------------------------------- + +rtl::OUString SAL_CALL SalGtkFolderPicker::getImplementationName() + throw( uno::RuntimeException ) +{ + return rtl::OUString::createFromAscii( FOLDER_PICKER_IMPL_NAME ); +} + +// ------------------------------------------------- +// XServiceInfo +// ------------------------------------------------- + +sal_Bool SAL_CALL SalGtkFolderPicker::supportsService( const rtl::OUString& ServiceName ) + throw( uno::RuntimeException ) +{ + uno::Sequence <rtl::OUString> SupportedServicesNames = FolderPicker_getSupportedServiceNames(); + + for( sal_Int32 n = SupportedServicesNames.getLength(); n--; ) + if( SupportedServicesNames[n].compareTo( ServiceName ) == 0) + return sal_True; + + return sal_False; +} + +// ------------------------------------------------- +// XServiceInfo +// ------------------------------------------------- + +uno::Sequence<rtl::OUString> SAL_CALL SalGtkFolderPicker::getSupportedServiceNames() + throw( uno::RuntimeException ) +{ + return FolderPicker_getSupportedServiceNames(); +} diff --git a/fpicker/source/unx/gnome/SalGtkFolderPicker.hxx b/fpicker/source/unx/gnome/SalGtkFolderPicker.hxx new file mode 100644 index 000000000000..553d83330b86 --- /dev/null +++ b/fpicker/source/unx/gnome/SalGtkFolderPicker.hxx @@ -0,0 +1,169 @@ +/************************************************************************* + * + * $RCSfile: SalGtkFolderPicker.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: hr $ $Date: 2004-09-08 17:08:07 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): Anil Bhatia + * + * + ************************************************************************/ + +#ifndef _SALGTKFOLDERPICKER_HXX_ +#define _SALGTKFOLDERPICKER_HXX_ + +//_______________________________________________________________________________________________________________________ +// includes of other projects +//_______________________________________________________________________________________________________________________ + +#ifndef _CPPUHELPER_COMPBASE3_HXX_ +#include <cppuhelper/implbase3.hxx> +#endif + +#ifndef _SALGTKPICKER_HXX_ +#include "SalGtkPicker.hxx" +#endif + +#include <memory> + +#ifndef _RTL_USTRING_H_ +#include <rtl/ustring.hxx> +#endif + +#include <list> + +//---------------------------------------------------------- +// class declaration +//---------------------------------------------------------- + +class SalGtkFolderPicker : + public SalGtkPicker, + public cppu::WeakImplHelper3< + ::com::sun::star::ui::dialogs::XFolderPicker, + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::util::XCancellable > +{ + public: + + // constructor + SalGtkFolderPicker( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceMgr ); + + //------------------------------------------------------------------------------------ + // XExecutableDialog functions + //------------------------------------------------------------------------------------ + + virtual void SAL_CALL setTitle( const ::rtl::OUString& aTitle ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Int16 SAL_CALL execute( ) + throw( ::com::sun::star::uno::RuntimeException ); + + //------------------------------------------------------------------------------------ + // XFolderPicker functions + //------------------------------------------------------------------------------------ + + virtual void SAL_CALL setDisplayDirectory( const rtl::OUString& rDirectory ) + throw( com::sun::star::lang::IllegalArgumentException, com::sun::star::uno::RuntimeException ); + + virtual rtl::OUString SAL_CALL getDisplayDirectory( ) + throw( com::sun::star::uno::RuntimeException ); + + virtual rtl::OUString SAL_CALL getDirectory( ) + throw( com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL setDescription( const rtl::OUString& rDescription ) + throw( com::sun::star::uno::RuntimeException ); + + + //------------------------------------------------ + // XServiceInfo + //------------------------------------------------ + + virtual ::rtl::OUString SAL_CALL getImplementationName( ) + throw(::com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) + throw(::com::sun::star::uno::RuntimeException); + + //------------------------------------------------ + // XCancellable + //------------------------------------------------ + + virtual void SAL_CALL cancel( ) + throw( ::com::sun::star::uno::RuntimeException ); + + //------------------------------------------------ + // XEventListener + //------------------------------------------------ + + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aEvent ) + throw(::com::sun::star::uno::RuntimeException); + + private: + // prevent copy and assignment + SalGtkFolderPicker( const SalGtkFolderPicker& ); + SalGtkFolderPicker& operator=( const SalGtkFolderPicker& ); + private: + // to instanciate own services + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceMgr; + +#if 0 + public: + virtual ~SalGtkFolderPicker(); +#endif +}; + +#endif // _SALGTKFOLDERPICKER_HXX_ diff --git a/fpicker/source/unx/gnome/SalGtkPicker.cxx b/fpicker/source/unx/gnome/SalGtkPicker.cxx new file mode 100644 index 000000000000..9439288db796 --- /dev/null +++ b/fpicker/source/unx/gnome/SalGtkPicker.cxx @@ -0,0 +1,151 @@ +/************************************************************************* + * + * $RCSfile: SalGtkPicker.cxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: hr $ $Date: 2004-09-08 17:08:31 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): Anil Bhatia + * + * + ************************************************************************/ + +//------------------------------------------------------------------------ +// includes +//------------------------------------------------------------------------ + +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif +#ifndef _CPPUHELPER_INTERFACECONTAINER_H_ +#include <cppuhelper/interfacecontainer.h> +#endif +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif +#ifndef _COM_SUN_STAR_UNO_ANY_HXX_ +#include <com/sun/star/uno/Any.hxx> +#endif +#ifndef _FPSERVICEINFO_HXX_ +#include <FPServiceInfo.hxx> +#endif +#ifndef _VOS_MUTEX_HXX_ +#include <vos/mutex.hxx> +#endif +#ifndef _SV_SVAPP_HXX +#include <vcl/svapp.hxx> +#endif +#ifndef _SALGTKPICKER_HXX_ +#include "SalGtkPicker.hxx" +#endif + +//------------------------------------------------------------------------ +// namespace directives +//------------------------------------------------------------------------ + +using namespace ::rtl; +using namespace ::com::sun::star; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::uno; + +SalGtkPicker::~SalGtkPicker() +{ + if (m_pDialog) + gtk_widget_destroy(m_pDialog); +} + +void SAL_CALL SalGtkPicker::implsetDisplayDirectory( const rtl::OUString& aDirectory ) + throw( lang::IllegalArgumentException, uno::RuntimeException ) +{ + OSL_ASSERT( m_pDialog != NULL ); + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + + OString aTxt = OUStringToOString( aDirectory, RTL_TEXTENCODING_UTF8 ); + + if( aTxt.lastIndexOf('/') == aTxt.getLength() - 1 ) + aTxt = aTxt.copy( 0, aTxt.getLength() - 1 ); + + OSL_TRACE( "setting path to %s\n", aTxt.getStr() ); + + gtk_file_chooser_set_current_folder_uri( GTK_FILE_CHOOSER( m_pDialog ), + aTxt.getStr() ); +} + +rtl::OUString SAL_CALL SalGtkPicker::implgetDisplayDirectory() throw( uno::RuntimeException ) +{ + OSL_ASSERT( m_pDialog != NULL ); + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + + gchar* pCurrentFolder = + gtk_file_chooser_get_current_folder_uri( GTK_FILE_CHOOSER( m_pDialog ) ); + ::rtl::OUString aCurrentFolderName = + ::rtl::OUString( const_cast<const sal_Char *>( pCurrentFolder ), + strlen( pCurrentFolder ), RTL_TEXTENCODING_UTF8 ); + g_free( pCurrentFolder ); + + return aCurrentFolderName; +} + +void SAL_CALL SalGtkPicker::implsetTitle( const rtl::OUString& aTitle ) throw( uno::RuntimeException ) +{ + OSL_ASSERT( m_pDialog != NULL ); + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + + ::rtl::OString aWindowTitle = OUStringToOString( aTitle, RTL_TEXTENCODING_UTF8 ); + gtk_window_set_title( GTK_WINDOW( m_pDialog ), aWindowTitle.getStr() ); + + fprintf(stderr, "title is %s\n", aWindowTitle.getStr()); + +} |