diff options
author | Michael Stahl <mstahl@redhat.com> | 2011-11-02 17:34:55 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2011-11-02 17:49:13 +0000 |
commit | 861a1c2dea41c141bffce54c30d53e65b7b88973 (patch) | |
tree | be455aa428b406d920aa4bcfad7de3a71553ecfd /fpicker | |
parent | a5925095882efee3cd2cfbecfdb43c72b47caf34 (diff) |
cleanup gtk / gdk locking situation to use the SolarMutex instead
The SolarMutex is integrated with native gtk+ toolkit locking so
this is semantically equivalent and rather less problematic.
Diffstat (limited to 'fpicker')
-rw-r--r-- | fpicker/source/unx/gnome/SalGtkFilePicker.cxx | 127 | ||||
-rw-r--r-- | fpicker/source/unx/gnome/SalGtkFilePicker.hxx | 9 | ||||
-rw-r--r-- | fpicker/source/unx/gnome/SalGtkFolderPicker.cxx | 18 | ||||
-rw-r--r-- | fpicker/source/unx/gnome/SalGtkPicker.cxx | 22 | ||||
-rw-r--r-- | fpicker/source/unx/gnome/SalGtkPicker.hxx | 2 |
5 files changed, 98 insertions, 80 deletions
diff --git a/fpicker/source/unx/gnome/SalGtkFilePicker.cxx b/fpicker/source/unx/gnome/SalGtkFilePicker.cxx index 9b5051afb9af..1cac9895c6ca 100644 --- a/fpicker/source/unx/gnome/SalGtkFilePicker.cxx +++ b/fpicker/source/unx/gnome/SalGtkFilePicker.cxx @@ -51,6 +51,8 @@ #include <osl/mutex.hxx> #include <SalGtkFilePicker.hxx> +#include <vcl/svapp.hxx> + #include <tools/string.hxx> #include <tools/urlobj.hxx> @@ -98,8 +100,6 @@ namespace static void expandexpanders(GtkContainer *pWidget) { - GdkThreadLock aLock; - GList *pChildren = gtk_container_get_children(pWidget); for( GList *p = pChildren; p; p = p->next ) { @@ -118,8 +118,6 @@ void SalGtkFilePicker::dialog_mapped_cb(GtkWidget *, SalGtkFilePicker *pobjFP) void SalGtkFilePicker::InitialMapping() { - GdkThreadLock aLock; - if (!mbPreviewState ) { gtk_widget_hide( m_pPreview ); @@ -180,8 +178,6 @@ SalGtkFilePicker::SalGtkFilePicker( const uno::Reference<lang::XMultiServiceFact CResourceProvider aResProvider; OUString aFilePickerTitle = aResProvider.getResString( FILE_PICKER_TITLE_OPEN ); - GdkThreadLock aLock; - m_pDialog = gtk_file_chooser_dialog_new( OUStringToOString( aFilePickerTitle, RTL_TEXTENCODING_UTF8 ).getStr(), NULL, @@ -359,12 +355,18 @@ SalGtkFilePicker::SalGtkFilePicker( const uno::Reference<lang::XMultiServiceFact void SAL_CALL SalGtkFilePicker::addFilePickerListener( const uno::Reference<XFilePickerListener>& xListener ) throw( uno::RuntimeException ) { + SolarMutexGuard g; + + OSL_ENSURE(!m_xListener.is(), + "SalGtkFilePicker only talks with one listener at a time..."); m_xListener = xListener; } void SAL_CALL SalGtkFilePicker::removeFilePickerListener( const uno::Reference<XFilePickerListener>& ) throw( uno::RuntimeException ) { + SolarMutexGuard g; + m_xListener.clear(); } @@ -374,6 +376,8 @@ void SAL_CALL SalGtkFilePicker::removeFilePickerListener( const uno::Reference<X void SAL_CALL SalGtkFilePicker::disposing( const lang::EventObject& aEvent ) throw( uno::RuntimeException ) { + // no member access => no mutex needed + uno::Reference<XFilePickerListener> xFilePickerListener( aEvent.Source, ::com::sun::star::uno::UNO_QUERY ); if( xFilePickerListener.is() ) @@ -384,19 +388,19 @@ void SAL_CALL SalGtkFilePicker::disposing( const lang::EventObject& aEvent ) thr // FilePicker Event functions //----------------------------------------------------------------------------------------- -void SAL_CALL SalGtkFilePicker::fileSelectionChanged( FilePickerEvent aEvent ) +void SalGtkFilePicker::impl_fileSelectionChanged( FilePickerEvent aEvent ) { OSL_TRACE( "file selection changed"); if (m_xListener.is()) m_xListener->fileSelectionChanged( aEvent ); } -void SAL_CALL SalGtkFilePicker::directoryChanged( FilePickerEvent aEvent ) +void SalGtkFilePicker::impl_directoryChanged( FilePickerEvent aEvent ) { OSL_TRACE("directory changed"); if (m_xListener.is()) m_xListener->directoryChanged( aEvent ); } -void SAL_CALL SalGtkFilePicker::controlStateChanged( FilePickerEvent aEvent ) +void SalGtkFilePicker::impl_controlStateChanged( FilePickerEvent aEvent ) { OSL_TRACE("control state changed"); if (m_xListener.is()) m_xListener->controlStateChanged( aEvent ); @@ -517,8 +521,6 @@ shrinkFilterName( const rtl::OUString &rFilterName, bool bAllowNoStar = false ) static void dialog_remove_buttons( GtkDialog *pDialog ) { - GdkThreadLock aLock; - g_return_if_fail( GTK_IS_DIALOG( pDialog ) ); GList *pChildren = @@ -627,6 +629,8 @@ void SalGtkFilePicker::ensureFilterList( const ::rtl::OUString& _rInitialCurrent void SAL_CALL SalGtkFilePicker::appendFilter( const rtl::OUString& aTitle, const rtl::OUString& aFilter ) throw( lang::IllegalArgumentException, uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); if( FilterNameExists( aTitle ) ) @@ -646,6 +650,8 @@ void SAL_CALL SalGtkFilePicker::appendFilter( const rtl::OUString& aTitle, const void SAL_CALL SalGtkFilePicker::setCurrentFilter( const rtl::OUString& aTitle ) throw( lang::IllegalArgumentException, uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); OSL_TRACE( "Setting current filter to %s\n", @@ -689,8 +695,6 @@ void SalGtkFilePicker::UpdateFilterfromUI() if (!mnHID_FolderChange || !mnHID_SelectionChange) return; - GdkThreadLock aLock; - GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(m_pFilterView)); GtkTreeIter iter; GtkTreeModel *model; @@ -712,6 +716,8 @@ void SalGtkFilePicker::UpdateFilterfromUI() rtl::OUString SAL_CALL SalGtkFilePicker::getCurrentFilter() throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); OSL_TRACE( "GetCURRENTfilter" ); @@ -731,6 +737,8 @@ rtl::OUString SAL_CALL SalGtkFilePicker::getCurrentFilter() throw( uno::RuntimeE void SAL_CALL SalGtkFilePicker::appendFilterGroup( const rtl::OUString& /*sGroupTitle*/, const uno::Sequence<beans::StringPair>& aFilters ) throw( lang::IllegalArgumentException, uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); // TODO m_pImpl->appendFilterGroup( sGroupTitle, aFilters ); @@ -760,9 +768,9 @@ void SAL_CALL SalGtkFilePicker::appendFilterGroup( const rtl::OUString& /*sGroup void SAL_CALL SalGtkFilePicker::setMultiSelectionMode( sal_Bool bMode ) throw( uno::RuntimeException ) { - OSL_ASSERT( m_pDialog != NULL ); + SolarMutexGuard g; - GdkThreadLock aLock; + OSL_ASSERT( m_pDialog != NULL ); gtk_file_chooser_set_select_multiple( GTK_FILE_CHOOSER(m_pDialog), bMode ); } @@ -770,9 +778,9 @@ void SAL_CALL SalGtkFilePicker::setMultiSelectionMode( sal_Bool bMode ) throw( u void SAL_CALL SalGtkFilePicker::setDefaultName( const rtl::OUString& aName ) throw( uno::RuntimeException ) { - OSL_ASSERT( m_pDialog != NULL ); + SolarMutexGuard g; - GdkThreadLock aLock; + OSL_ASSERT( m_pDialog != NULL ); OString aStr = OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ); GtkFileChooserAction eAction = gtk_file_chooser_get_action( GTK_FILE_CHOOSER( m_pDialog ) ); @@ -785,16 +793,22 @@ void SAL_CALL SalGtkFilePicker::setDefaultName( const rtl::OUString& aName ) void SAL_CALL SalGtkFilePicker::setDisplayDirectory( const rtl::OUString& rDirectory ) throw( lang::IllegalArgumentException, uno::RuntimeException ) { + SolarMutexGuard g; + implsetDisplayDirectory(rDirectory); } rtl::OUString SAL_CALL SalGtkFilePicker::getDisplayDirectory() throw( uno::RuntimeException ) { + SolarMutexGuard g; + return implgetDisplayDirectory(); } uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getFiles() throw( uno::RuntimeException ) { + // no member access => no mutex needed + uno::Sequence< rtl::OUString > aFiles = getSelectedFiles(); /* The previous multiselection API design was completely broken @@ -807,9 +821,9 @@ uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getFiles() throw( uno::R uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getSelectedFiles() throw( uno::RuntimeException ) { - OSL_ASSERT( m_pDialog != NULL ); + SolarMutexGuard g; - GdkThreadLock aLock; + OSL_ASSERT( m_pDialog != NULL ); GSList* pPathList = gtk_file_chooser_get_uris( GTK_FILE_CHOOSER(m_pDialog) ); @@ -953,16 +967,18 @@ uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getSelectedFiles() throw void SAL_CALL SalGtkFilePicker::setTitle( const rtl::OUString& rTitle ) throw( uno::RuntimeException ) { + SolarMutexGuard g; + implsetTitle(rTitle); } sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_TRACE( "1: HERE WE ARE"); OSL_ASSERT( m_pDialog != NULL ); - GdkThreadLock aLock; - sal_Int16 retVal = 0; SetFilters(); @@ -1067,7 +1083,7 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException ) FilePickerEvent evt; evt.ElementId = PUSHBUTTON_PLAY; OSL_TRACE( "filter_changed, isn't it great %x", this); - controlStateChanged( evt ); + impl_controlStateChanged( evt ); btn = GTK_RESPONSE_NO; } break; @@ -1148,8 +1164,6 @@ namespace { void HackWidthToFirst(GtkComboBox *pWidget) { - GdkThreadLock aLock; - GtkRequisition requisition; gtk_widget_size_request(GTK_WIDGET(pWidget), &requisition); gtk_widget_set_size_request(GTK_WIDGET(pWidget), requisition.width, -1); @@ -1158,8 +1172,6 @@ namespace void SalGtkFilePicker::HandleSetListValue(GtkComboBox *pWidget, sal_Int16 nControlAction, const uno::Any& rValue) { - GdkThreadLock aLock; - switch (nControlAction) { case ControlActions::ADD_ITEM: @@ -1234,8 +1246,6 @@ void SalGtkFilePicker::HandleSetListValue(GtkComboBox *pWidget, sal_Int16 nContr uno::Any SalGtkFilePicker::HandleGetListValue(GtkComboBox *pWidget, sal_Int16 nControlAction) const { - GdkThreadLock aLock; - uno::Any aAny; switch (nControlAction) { @@ -1294,14 +1304,14 @@ uno::Any SalGtkFilePicker::HandleGetListValue(GtkComboBox *pWidget, sal_Int16 nC void SAL_CALL SalGtkFilePicker::setValue( sal_Int16 nControlId, sal_Int16 nControlAction, const uno::Any& rValue ) throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); OSL_TRACE( "SETTING VALUE %d", nControlAction ); GType tType; GtkWidget *pWidget; - GdkThreadLock aLock; - if( !( pWidget = getWidget( nControlId, &tType ) ) ) OSL_TRACE("enable unknown control %d", nControlId); else if( tType == GTK_TYPE_TOGGLE_BUTTON ) @@ -1322,6 +1332,8 @@ void SAL_CALL SalGtkFilePicker::setValue( sal_Int16 nControlId, sal_Int16 nContr uno::Any SAL_CALL SalGtkFilePicker::getValue( sal_Int16 nControlId, sal_Int16 nControlAction ) throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); uno::Any aRetval; @@ -1329,8 +1341,6 @@ uno::Any SAL_CALL SalGtkFilePicker::getValue( sal_Int16 nControlId, sal_Int16 nC GType tType; GtkWidget *pWidget; - GdkThreadLock aLock; - if( !( pWidget = getWidget( nControlId, &tType ) ) ) OSL_TRACE("enable unknown control %d", nControlId); else if( tType == GTK_TYPE_TOGGLE_BUTTON ) @@ -1347,12 +1357,12 @@ uno::Any SAL_CALL SalGtkFilePicker::getValue( sal_Int16 nControlId, sal_Int16 nC void SAL_CALL SalGtkFilePicker::enableControl( sal_Int16 nControlId, sal_Bool bEnable ) throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); GtkWidget *pWidget; - GdkThreadLock aLock; - if ( nControlId == ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR ) gtk_expander_set_expanded( GTK_EXPANDER( m_pFilterExpander ), bEnable ); else if( ( pWidget = getWidget( nControlId ) ) ) @@ -1375,13 +1385,13 @@ throw( uno::RuntimeException ) void SAL_CALL SalGtkFilePicker::setLabel( sal_Int16 nControlId, const ::rtl::OUString& rLabel ) throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); GType tType; GtkWidget *pWidget; - GdkThreadLock aLock; - if( !( pWidget = getWidget( nControlId, &tType ) ) ) { OSL_TRACE("Set label on unknown control %d", nControlId); @@ -1412,14 +1422,14 @@ void SAL_CALL SalGtkFilePicker::setLabel( sal_Int16 nControlId, const ::rtl::OUS rtl::OUString SAL_CALL SalGtkFilePicker::getLabel( sal_Int16 nControlId ) throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); GType tType; OString aTxt; GtkWidget *pWidget; - GdkThreadLock aLock; - if( !( pWidget = getWidget( nControlId, &tType ) ) ) OSL_TRACE("Get label on unknown control %d", nControlId); else if( tType == GTK_TYPE_TOGGLE_BUTTON || tType == GTK_TYPE_BUTTON || tType == GTK_TYPE_LABEL ) @@ -1436,6 +1446,8 @@ rtl::OUString SAL_CALL SalGtkFilePicker::getLabel( sal_Int16 nControlId ) uno::Sequence<sal_Int16> SAL_CALL SalGtkFilePicker::getSupportedImageFormats() throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); // TODO return m_pImpl->getSupportedImageFormats(); @@ -1444,6 +1456,8 @@ uno::Sequence<sal_Int16> SAL_CALL SalGtkFilePicker::getSupportedImageFormats() t sal_Int32 SAL_CALL SalGtkFilePicker::getTargetColorDepth() throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); // TODO return m_pImpl->getTargetColorDepth(); @@ -1452,6 +1466,8 @@ sal_Int32 SAL_CALL SalGtkFilePicker::getTargetColorDepth() throw( uno::RuntimeEx sal_Int32 SAL_CALL SalGtkFilePicker::getAvailableWidth() throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); return m_PreviewImageWidth; @@ -1459,6 +1475,8 @@ sal_Int32 SAL_CALL SalGtkFilePicker::getAvailableWidth() throw( uno::RuntimeExce sal_Int32 SAL_CALL SalGtkFilePicker::getAvailableHeight() throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); return m_PreviewImageHeight; @@ -1467,6 +1485,8 @@ sal_Int32 SAL_CALL SalGtkFilePicker::getAvailableHeight() throw( uno::RuntimeExc void SAL_CALL SalGtkFilePicker::setImage( sal_Int16 /*aImageFormat*/, const uno::Any& /*aImage*/ ) throw( lang::IllegalArgumentException, uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); // TODO m_pImpl->setImage( aImageFormat, aImage ); @@ -1477,8 +1497,6 @@ void SalGtkFilePicker::implChangeType( GtkTreeSelection *selection ) CResourceProvider aResProvider; OUString aLabel = aResProvider.getResString( FILE_PICKER_FILE_TYPE ); - GdkThreadLock aLock; - GtkTreeIter iter; GtkTreeModel *model; if (gtk_tree_selection_get_selected (selection, &model, &iter)) @@ -1493,7 +1511,7 @@ void SalGtkFilePicker::implChangeType( GtkTreeSelection *selection ) OUStringToOString( aLabel, RTL_TEXTENCODING_UTF8 ).getStr()); FilePickerEvent evt; evt.ElementId = LISTBOX_FILTER; - controlStateChanged( evt ); + impl_controlStateChanged( evt ); } void SalGtkFilePicker::type_changed_cb( GtkTreeSelection *selection, SalGtkFilePicker *pobjFP ) @@ -1503,8 +1521,6 @@ void SalGtkFilePicker::type_changed_cb( GtkTreeSelection *selection, SalGtkFileP void SalGtkFilePicker::unselect_type() { - GdkThreadLock aLock; - gtk_tree_selection_unselect_all(gtk_tree_view_get_selection(GTK_TREE_VIEW(m_pFilterView))); } @@ -1520,21 +1536,21 @@ void SalGtkFilePicker::filter_changed_cb( GtkFileChooser *, GParamSpec *, FilePickerEvent evt; evt.ElementId = LISTBOX_FILTER; OSL_TRACE( "filter_changed, isn't it great %x", pobjFP ); - pobjFP->controlStateChanged( evt ); + pobjFP->impl_controlStateChanged( evt ); } void SalGtkFilePicker::folder_changed_cb( GtkFileChooser *, SalGtkFilePicker *pobjFP ) { FilePickerEvent evt; OSL_TRACE( "folder_changed, isn't it great %x", pobjFP ); - pobjFP->directoryChanged( evt ); + pobjFP->impl_directoryChanged( evt ); } void SalGtkFilePicker::selection_changed_cb( GtkFileChooser *, SalGtkFilePicker *pobjFP ) { FilePickerEvent evt; OSL_TRACE( "selection_changed, isn't it great %x", pobjFP ); - pobjFP->fileSelectionChanged( evt ); + pobjFP->impl_fileSelectionChanged( evt ); } void SalGtkFilePicker::update_preview_cb( GtkFileChooser *file_chooser, SalGtkFilePicker* pobjFP ) @@ -1570,13 +1586,13 @@ void SalGtkFilePicker::update_preview_cb( GtkFileChooser *file_chooser, SalGtkFi sal_Bool SAL_CALL SalGtkFilePicker::setShowState( sal_Bool bShowState ) throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); // TODO return m_pImpl->setShowState( bShowState ); if( bShowState != mbPreviewState ) { - GdkThreadLock aLock; - if( bShowState ) { // Show @@ -1604,6 +1620,8 @@ sal_Bool SAL_CALL SalGtkFilePicker::setShowState( sal_Bool bShowState ) throw( u sal_Bool SAL_CALL SalGtkFilePicker::getShowState() throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); return mbPreviewState; @@ -1637,6 +1655,7 @@ void SAL_CALL SalGtkFilePicker::initialize( const uno::Sequence<uno::Any>& aArgu GtkFileChooserAction eAction = GTK_FILE_CHOOSER_ACTION_OPEN; const gchar *first_button_text = GTK_STOCK_OPEN; + SolarMutexGuard g; // TODO: extract full semantic from // svtools/source/filepicker/filepicker.cxx (getWinBits) @@ -1721,8 +1740,6 @@ void SAL_CALL SalGtkFilePicker::initialize( const uno::Sequence<uno::Any>& aArgu 1 ); } - GdkThreadLock aLock; - if( GTK_FILE_CHOOSER_ACTION_SAVE == eAction ) { CResourceProvider aResProvider; @@ -1783,6 +1800,8 @@ void SalGtkFilePicker::preview_toggled_cb( GtkObject *cb, SalGtkFilePicker* pobj void SAL_CALL SalGtkFilePicker::cancel() throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); // TODO m_pImpl->cancel(); @@ -1830,8 +1849,6 @@ uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getSupportedServiceNames //------------------------------------------------- void SalGtkFilePicker::SetCurFilter( const OUString& rFilter ) { - GdkThreadLock aLock; - // Get all the filters already added GSList *filters = gtk_file_chooser_list_filters ( GTK_FILE_CHOOSER( m_pDialog ) ); bool bFound = false; @@ -1887,8 +1904,6 @@ case_insensitive_filter (const GtkFileFilterInfo *filter_info, gpointer data) GtkFileFilter* SalGtkFilePicker::implAddFilter( const OUString& rFilter, const OUString& rType ) { - GdkThreadLock aLock; - GtkFileFilter *filter = gtk_file_filter_new(); OUString aShrunkName = shrinkFilterName( rFilter ); @@ -1962,8 +1977,6 @@ void SalGtkFilePicker::implAddFilterGroup( const OUString& /*_rFilter*/, const S void SalGtkFilePicker::SetFilters() { - GdkThreadLock aLock; - if (!m_aInitialFilter.getLength()) m_aInitialFilter = m_aCurrentFilter; @@ -2047,6 +2060,8 @@ void SalGtkFilePicker::SetFilters() SalGtkFilePicker::~SalGtkFilePicker() { + SolarMutexGuard g; + int i; for( i = 0; i < TOGGLE_LAST; i++ ) diff --git a/fpicker/source/unx/gnome/SalGtkFilePicker.hxx b/fpicker/source/unx/gnome/SalGtkFilePicker.hxx index b846eb351d76..e15de9c08df6 100644 --- a/fpicker/source/unx/gnome/SalGtkFilePicker.hxx +++ b/fpicker/source/unx/gnome/SalGtkFilePicker.hxx @@ -241,10 +241,6 @@ class SalGtkFilePicker : // FilePicker Event functions //------------------------------------------------------------------------------------ - void SAL_CALL fileSelectionChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent ); - void SAL_CALL directoryChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent ); - void SAL_CALL controlStateChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent ); - private: // prevent copy and assignment SalGtkFilePicker( const SalGtkFilePicker& ); @@ -258,6 +254,11 @@ class SalGtkFilePicker : // to instanciate own services ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceMgr; + void impl_fileSelectionChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent ); + void impl_directoryChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent ); + void impl_controlStateChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent ); + + private: ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener > m_xListener; diff --git a/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx b/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx index 328038f5cfc2..52d9c78ba1e0 100644 --- a/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx +++ b/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx @@ -47,6 +47,7 @@ #include <com/sun/star/uno/Any.hxx> #include <FPServiceInfo.hxx> #include <osl/mutex.hxx> +#include <vcl/svapp.hxx> #include "SalGtkFolderPicker.hxx" #include "resourceprovider.hxx" @@ -87,8 +88,6 @@ SalGtkFolderPicker::SalGtkFolderPicker( const uno::Reference<lang::XMultiService { CResourceProvider aResProvider; - GdkThreadLock aLock; - m_pDialog = gtk_file_chooser_dialog_new( OUStringToOString( aResProvider.getResString( FOLDERPICKER_TITLE ), RTL_TEXTENCODING_UTF8 ).getStr(), NULL, GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, @@ -111,6 +110,8 @@ void SAL_CALL SalGtkFolderPicker::disposing( const lang::EventObject& ) void SAL_CALL SalGtkFolderPicker::setDisplayDirectory( const rtl::OUString& aDirectory ) throw( lang::IllegalArgumentException, uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); OString aTxt = unicodetouri( aDirectory ); @@ -120,17 +121,15 @@ void SAL_CALL SalGtkFolderPicker::setDisplayDirectory( const rtl::OUString& aDir OSL_TRACE( "setting path to %s", aTxt.getStr() ); - GdkThreadLock aLock; - 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 ); + SolarMutexGuard g; - GdkThreadLock aLock; + OSL_ASSERT( m_pDialog != NULL ); gchar* pCurrentFolder = gtk_file_chooser_get_current_folder_uri( GTK_FILE_CHOOSER( m_pDialog ) ); @@ -159,16 +158,19 @@ void SAL_CALL SalGtkFolderPicker::setDescription( const rtl::OUString& rDescript void SAL_CALL SalGtkFolderPicker::setTitle( const rtl::OUString& aTitle ) throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); ::rtl::OString aWindowTitle = OUStringToOString( aTitle, RTL_TEXTENCODING_UTF8 ); - GdkThreadLock aLock; gtk_window_set_title( GTK_WINDOW( m_pDialog ), aWindowTitle.getStr() ); } sal_Int16 SAL_CALL SalGtkFolderPicker::execute() throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_TRACE( "1: HERE WE ARE"); OSL_ASSERT( m_pDialog != NULL ); @@ -205,6 +207,8 @@ sal_Int16 SAL_CALL SalGtkFolderPicker::execute() throw( uno::RuntimeException ) void SAL_CALL SalGtkFolderPicker::cancel() throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); // TODO m_pImpl->cancel(); diff --git a/fpicker/source/unx/gnome/SalGtkPicker.cxx b/fpicker/source/unx/gnome/SalGtkPicker.cxx index ee8ac305530f..e3283e3f13ab 100644 --- a/fpicker/source/unx/gnome/SalGtkPicker.cxx +++ b/fpicker/source/unx/gnome/SalGtkPicker.cxx @@ -120,6 +120,8 @@ rtl::OString SalGtkPicker::unicodetouri(const rtl::OUString &rURL) gboolean canceldialog(RunDialog *pDialog) { + GdkThreadLock lock; + pDialog->cancel(); return false; } @@ -157,8 +159,6 @@ RunDialog::RunDialog( GtkWidget *pDialog, uno::Reference< awt::XExtendedToolkit } } - GdkThreadLock aLock; - GdkDisplay *pDisplay = aWindowHandle.DisplayPointer ? gdk_x11_lookup_xdisplay(reinterpret_cast<void*>(static_cast<sal_IntPtr>(aWindowHandle.DisplayPointer))) : NULL; GdkWindow* pParent = pDisplay ? gdk_window_lookup_for_display(pDisplay, aWindowHandle.WindowHandle) : NULL; if (!pParent && pDisplay) @@ -173,9 +173,10 @@ RunDialog::RunDialog( GtkWidget *pDialog, uno::Reference< awt::XExtendedToolkit RunDialog::~RunDialog() { + SolarMutexGuard g; + if (mpCreatedParent) { - GdkThreadLock aLock; gdk_window_destroy (mpCreatedParent); } } @@ -183,7 +184,8 @@ RunDialog::~RunDialog() void SAL_CALL RunDialog::windowOpened( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException) { - GdkThreadLock aLock; + SolarMutexGuard g; + g_timeout_add_full(G_PRIORITY_HIGH_IDLE, 0, (GSourceFunc)canceldialog, this, NULL); } @@ -195,13 +197,13 @@ void SAL_CALL RunDialog::queryTermination( const ::com::sun::star::lang::EventOb void SAL_CALL RunDialog::notifyTermination( const ::com::sun::star::lang::EventObject& ) throw(::com::sun::star::uno::RuntimeException) { - GdkThreadLock aLock; + SolarMutexGuard g; + g_timeout_add_full(G_PRIORITY_HIGH_IDLE, 0, (GSourceFunc)canceldialog, this, NULL); } void RunDialog::cancel() { - GdkThreadLock aLock; gtk_dialog_response( GTK_DIALOG( mpDialog ), GTK_RESPONSE_CANCEL ); gtk_widget_hide( mpDialog ); } @@ -211,7 +213,6 @@ gint RunDialog::run() if (mxToolkit.is()) mxToolkit->addTopWindowListener(this); - GdkThreadLock aLock; gint nStatus = gtk_dialog_run( GTK_DIALOG( mpDialog ) ); if (mxToolkit.is()) @@ -265,9 +266,10 @@ SalGtkPicker::SalGtkPicker(const uno::Reference<lang::XMultiServiceFactory>& xSe SalGtkPicker::~SalGtkPicker() { + SolarMutexGuard g; + if (m_pDialog) { - GdkThreadLock aLock; gtk_widget_destroy(m_pDialog); } } @@ -284,7 +286,6 @@ void SAL_CALL SalGtkPicker::implsetDisplayDirectory( const rtl::OUString& aDirec OSL_TRACE( "setting path to %s", aTxt.getStr() ); - GdkThreadLock aLock; gtk_file_chooser_set_current_folder_uri( GTK_FILE_CHOOSER( m_pDialog ), aTxt.getStr() ); } @@ -293,8 +294,6 @@ rtl::OUString SAL_CALL SalGtkPicker::implgetDisplayDirectory() throw( uno::Runti { OSL_ASSERT( m_pDialog != NULL ); - GdkThreadLock aLock; - gchar* pCurrentFolder = gtk_file_chooser_get_current_folder_uri( GTK_FILE_CHOOSER( m_pDialog ) ); ::rtl::OUString aCurrentFolderName = uritounicode(pCurrentFolder); @@ -309,7 +308,6 @@ void SAL_CALL SalGtkPicker::implsetTitle( const rtl::OUString& aTitle ) throw( u ::rtl::OString aWindowTitle = OUStringToOString( aTitle, RTL_TEXTENCODING_UTF8 ); - GdkThreadLock aLock; gtk_window_set_title( GTK_WINDOW( m_pDialog ), aWindowTitle.getStr() ); } diff --git a/fpicker/source/unx/gnome/SalGtkPicker.hxx b/fpicker/source/unx/gnome/SalGtkPicker.hxx index 92b29e728a59..cd9e6553a925 100644 --- a/fpicker/source/unx/gnome/SalGtkPicker.hxx +++ b/fpicker/source/unx/gnome/SalGtkPicker.hxx @@ -128,9 +128,9 @@ public: ::com::sun::star::uno::Reference< ::com::sun::star::awt::XExtendedToolkit > &rToolkit, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop > &rDesktop ); + virtual ~RunDialog(); gint run(); void cancel(); - ~RunDialog(); }; #endif |