[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

rpms/openoffice.org/devel openoffice.org-1.9.116.rhXXXXX.desktop.noexpand.patch, NONE, 1.1 workspace.fpicker4.patch, NONE, 1.1 openoffice.org.spec, 1.294, 1.295 workspace-fpicker4.patch, 1.4, NONE



Author: caolanm

Update of /cvs/dist/rpms/openoffice.org/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv30712

Modified Files:
	openoffice.org.spec 
Added Files:
	openoffice.org-1.9.116.rhXXXXX.desktop.noexpand.patch 
	workspace.fpicker4.patch 
Removed Files:
	workspace-fpicker4.patch 
Log Message:
try out new fpicker stuff

openoffice.org-1.9.116.rhXXXXX.desktop.noexpand.patch:
 desktop/scripts/soffice.sh |    1 +
 scripts/soffice.sh         |    0 
 2 files changed, 1 insertion(+)

--- NEW FILE openoffice.org-1.9.116.rhXXXXX.desktop.noexpand.patch ---
Index: scripts/soffice.sh
===================================================================
RCS file: /cvs/framework/desktop/scripts/soffice.sh,v
retrieving revision 1.17
diff -u -p -u -r1.17 soffice.sh
--- openoffice.org.orig/desktop/scripts/soffice.sh	15 Jun 2005 08:16:47 -0000	1.17
+++ openoffice.org/desktop/scripts/soffice.sh	11 Jul 2005 14:16:21 -0000
@@ -64,6 +64,7 @@
 SAL_ENABLE_FILE_LOCKING=1
 export SAL_ENABLE_FILE_LOCKING
 
+export SAL_NOEXPANDFPICKER=TRUE
 # the following test is needed on Linux PPC with IBM j2sdk142
 if [ `uname -s` = "Linux" -a  "`uname -m`" = "ppc" ] ; then
     JITC_PROCESSOR_TYPE=6

workspace.fpicker4.patch:
 SalGtkFilePicker.cxx |  414 +++++++++++++++++++++++++++++++--------------------
 SalGtkFilePicker.hxx |   34 ++--
 SalGtkPicker.cxx     |   19 +-
 SalGtkPicker.hxx     |    5 
 makefile.mk          |    2 
 5 files changed, 293 insertions(+), 181 deletions(-)

--- NEW FILE workspace.fpicker4.patch ---
? source/unx/gnome/arse
Index: source/unx/gnome/SalGtkFilePicker.cxx
===================================================================
RCS file: /cvs/gsl/fpicker/source/unx/gnome/SalGtkFilePicker.cxx,v
retrieving revision 1.6
retrieving revision 1.6.6.6
diff -u -r1.6 -r1.6.6.6
--- openoffice.org.orig/fpicker/source/unx/gnome/SalGtkFilePicker.cxx	3 May 2005 13:47:32 -0000	1.6
+++ openoffice.org/fpicker/source/unx/gnome/SalGtkFilePicker.cxx	11 Jul 2005 14:01:34 -0000	1.6.6.6
@@ -109,8 +109,6 @@
 #include <SalGtkFilePicker.hxx>
 #endif
 
-#include "filepickereventnotification.hxx"
-
 #include <tools/urlobj.hxx>
 
 #include <iostream>
@@ -156,6 +154,34 @@
 // constructor
 //-----------------------------------------------------------------------------------------
 
+static void expandexpanders(GtkContainer *pWidget)
+{
+    GList *pChildren = gtk_container_get_children(pWidget);
+    for( GList *p = pChildren; p; p = p->next )
+    {
+        if GTK_IS_CONTAINER(GTK_WIDGET(p->data))
+            expandexpanders(GTK_CONTAINER(GTK_WIDGET(p->data)));
+        if GTK_IS_EXPANDER(GTK_WIDGET(p->data))
+            gtk_expander_set_expanded(GTK_EXPANDER(GTK_WIDGET(p->data)), TRUE);
+    }
+    g_list_free(pChildren);
+}
+
+void SalGtkFilePicker::dialog_mapped_cb(GtkWidget *widget, SalGtkFilePicker *pobjFP)
+{
+    pobjFP->InitialMapping();
+}
+
+void SalGtkFilePicker::InitialMapping()
+{
+    if (!mbPreviewState )
+    {
+        gtk_widget_hide( m_pPreview );
+        gtk_file_chooser_set_preview_widget_active( GTK_FILE_CHOOSER( m_pDialog ), false);
+    }
+    gtk_widget_set_size_request (m_pPreview, -1, -1);
+}
+
 SalGtkFilePicker::SalGtkFilePicker( const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr ) : 
 	cppu::WeakComponentImplHelper9< 		
 		XFilterManager, 
@@ -168,13 +194,10 @@
 		lang::XEventListener, 
 		lang::XServiceInfo>( m_rbHelperMtx ),
 	m_xServiceMgr( xServiceMgr ),
-	m_aAsyncEventNotifier( rBHelper ),
 	m_pVBox ( NULL ),
 	m_pFilterList( NULL ),
     bVersionWidthUnset( false ),
     mbPreviewState( sal_False ),
-	mHID_Preview( ( gulong ) NULL ),
-	mHID_FolderChange( ( gulong ) NULL ),
 	m_pPreview( NULL ),
 	m_PreviewImageWidth( 256 ),
 	m_PreviewImageHeight( 256 )
@@ -302,16 +325,78 @@
         gtk_box_pack_end( GTK_BOX( m_pVBox ), m_pHBoxs[i], FALSE, FALSE, 0 );
 	}
 
+    aLabel = aResProvider.getResString( FILE_PICKER_FILE_TYPE );
+    m_pFilterExpander = gtk_expander_new_with_mnemonic(
+        OUStringToOString( aLabel, RTL_TEXTENCODING_UTF8 ).getStr());
+
+    gtk_box_pack_end( GTK_BOX( m_pVBox ), m_pFilterExpander, FALSE, TRUE, 0 );
+
+    GtkWidget *scrolled_window = gtk_scrolled_window_new (NULL, NULL);
+    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
+        GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+    gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
+        GTK_SHADOW_IN);
+    gtk_container_add (GTK_CONTAINER (m_pFilterExpander), scrolled_window);
+    gtk_widget_show (scrolled_window);
+
+    ByteString sNoGL( getenv( "SAL_NOEXPANDFPICKER" ) );
+    if( sNoGL.ToLowerAscii() != "true"  )
+    {
+        expandexpanders(GTK_CONTAINER(m_pDialog));
+        gtk_expander_set_expanded(GTK_EXPANDER(m_pFilterExpander), TRUE);
+    }
+
+    m_pFilterStore = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_STRING,
+        G_TYPE_STRING, G_TYPE_STRING);
+    m_pFilterView = gtk_tree_view_new_with_model (GTK_TREE_MODEL(m_pFilterStore));
+    gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(m_pFilterView), false);
+    gtk_tree_view_set_rules_hint (GTK_TREE_VIEW(m_pFilterView), true);
+    
+    GtkTreeViewColumn *column;
+    GtkCellRenderer *cell;
+
+    for (int i = 0; i < 2; ++i)
+    {
+        column = gtk_tree_view_column_new ();
+        cell = gtk_cell_renderer_text_new ();
+        gtk_tree_view_column_set_expand (column, TRUE);
+        gtk_tree_view_column_pack_start (column, cell, FALSE);
+        gtk_tree_view_column_set_attributes (column, cell, "text", i, NULL);
+        gtk_tree_view_append_column (GTK_TREE_VIEW(m_pFilterView), column);
+    }
+
+    gtk_container_add (GTK_CONTAINER (scrolled_window), m_pFilterView);
+    gtk_widget_show (m_pFilterView);
+
 	gtk_file_chooser_set_extra_widget( GTK_FILE_CHOOSER( m_pDialog ), m_pVBox );
 
+	m_pPreview = gtk_image_new();
+	gtk_file_chooser_set_preview_widget( GTK_FILE_CHOOSER( m_pDialog ), m_pPreview );
+
 	g_signal_connect( G_OBJECT( m_pToggles[PREVIEW] ), "toggled",
 					  G_CALLBACK( preview_toggled_cb ), this );
-//	g_signal_connect( G_OBJECT( m_pFilterComboBox ), "changed",
-//					  G_CALLBACK( filter_changed_atsave_cb ), this );
+    g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW(m_pFilterView)), "changed",
+                      G_CALLBACK ( type_changed_cb ), this);
 	g_signal_connect( G_OBJECT( m_pDialog ), "notify::filter",
-					  G_CALLBACK( filter_changed_cb ), this );
+					  G_CALLBACK( filter_changed_cb ), this);
+	g_signal_connect( G_OBJECT( m_pFilterExpander ), "activate",
+					  G_CALLBACK( expander_changed_cb ), this);
+    g_signal_connect (G_OBJECT( m_pDialog ), "map", 
+                      G_CALLBACK (dialog_mapped_cb), this);
 
     gtk_widget_show( m_pVBox );
+
+    PangoLayout  *layout = gtk_widget_create_pango_layout (m_pFilterView, NULL);
+    guint ypad;
+    PangoRectangle row_height;
+    pango_layout_set_markup (layout, "All Files", -1);
+    pango_layout_get_pixel_extents (layout, NULL, &row_height);
+    g_object_get (cell, "ypad", &ypad, NULL);
+    guint height = (row_height.height + 2*ypad) * 5;
+    gtk_widget_set_size_request (m_pFilterView, -1, height);
+    gtk_widget_set_size_request (m_pPreview, 1, height);
+
+    gtk_file_chooser_set_preview_widget_active( GTK_FILE_CHOOSER( m_pDialog ), true);
 }
 
 //------------------------------------------------------------------------------------
@@ -321,22 +406,15 @@
 void SAL_CALL SalGtkFilePicker::addFilePickerListener( const uno::Reference<XFilePickerListener>& xListener )
 	throw( uno::RuntimeException )
 {
-	if( rBHelper.bDisposed )
-		throw lang::DisposedException( rtl::OUString::createFromAscii( "object is already disposed" ),
-						static_cast< XFilePicker* >( this ) );
-
-	if( !rBHelper.bInDispose && !rBHelper.bDisposed )
-		rBHelper.aLC.addInterface( getCppuType( &xListener ), xListener );
+    ::vos::OGuard aGuard( Application::GetSolarMutex() );
+    m_xListener = xListener;
 }
 
 void SAL_CALL SalGtkFilePicker::removeFilePickerListener( const uno::Reference<XFilePickerListener>& xListener )
 	throw( uno::RuntimeException )
 {
-	if( rBHelper.bDisposed )
-		throw lang::DisposedException( rtl::OUString::createFromAscii( "object is already disposed" ),
-					       static_cast< XFilePicker* >( this ) );
-
-	rBHelper.aLC.removeInterface( getCppuType( &xListener ), xListener );
+    ::vos::OGuard aGuard( Application::GetSolarMutex() );
+    m_xListener.clear();
 }
 
 // -------------------------------------------------
@@ -358,31 +436,26 @@
 void SAL_CALL SalGtkFilePicker::fileSelectionChanged( FilePickerEvent aEvent ) 
 {
 	OSL_TRACE( "file selection changed");
-	aEvent.Source = uno::Reference<uno::XInterface>( static_cast<XFilePickerNotifier*>( this ) );
-	m_aAsyncEventNotifier.notifyEvent(
-		new SalGtkFilePickerParamEventNotification( &XFilePickerListener::fileSelectionChanged, aEvent ) );
+    if (m_xListener.is()) m_xListener->fileSelectionChanged( aEvent );
 }
 
 void SAL_CALL SalGtkFilePicker::directoryChanged( FilePickerEvent aEvent ) 
 {
 	OSL_TRACE("directory changed");
-	aEvent.Source = uno::Reference<uno::XInterface>( static_cast<XFilePickerNotifier*>( this ) );
-	m_aAsyncEventNotifier.notifyEvent(
-		new SalGtkFilePickerParamEventNotification( &XFilePickerListener::directoryChanged, aEvent ) );
+    if (m_xListener.is()) m_xListener->directoryChanged( aEvent );
 }
 
 void SAL_CALL SalGtkFilePicker::controlStateChanged( FilePickerEvent aEvent ) 
 {	
-	aEvent.Source = uno::Reference<uno::XInterface>( static_cast<XFilePickerNotifier*>( this ) );
-	m_aAsyncEventNotifier.notifyEvent(
-		new SalGtkFilePickerParamEventNotification( &XFilePickerListener::controlStateChanged, aEvent ) );
+	OSL_TRACE("control state changed");
+    if (m_xListener.is()) m_xListener->controlStateChanged( aEvent );
 }
 
 void SAL_CALL SalGtkFilePicker::dialogSizeChanged() 
 {
+    OSL_TRACE("dialog size changed");
 	/*
-	m_aAsyncEventNotifier.notifyEvent(
-		new SalGtkFilePickerEventNotification( &XFilePickerListener::dialogSizeChanged ) );
+    if (m_xListener.is()) m_xListener->dialogSizeChanged( aEvent );
 	*/
 }
 
@@ -432,48 +505,6 @@
 	return aHelpText;
 }
 
-bool SalGtkFilePicker::startupEventNotification( bool bStartupSuspended ) 
-{
-	OSL_TRACE( "attempting to start\n");
-	bool bRet = m_aAsyncEventNotifier.startup( bStartupSuspended );
-	if (bRet)
-	{
-		mHID_FolderChange = 
-			g_signal_connect( GTK_FILE_CHOOSER( m_pDialog ), "current-folder-changed",
-				G_CALLBACK( folder_changed_cb ), ( gpointer )this );
-
-		mHID_SelectionChange = 
-			g_signal_connect( GTK_FILE_CHOOSER( m_pDialog ), "selection-changed",
-				G_CALLBACK( selection_changed_cb ), ( gpointer )this );
-
-	}
-	return bRet;
-}
-
-void SalGtkFilePicker::shutdownEventNotification()
-{
-	OSL_TRACE( "before terminate, risky for some reason\n" );
-	m_aAsyncEventNotifier.shutdown();
-	if (mHID_FolderChange)
-		g_signal_handler_disconnect(GTK_FILE_CHOOSER( m_pDialog ), mHID_FolderChange);
-	if (mHID_SelectionChange)
-		g_signal_handler_disconnect(GTK_FILE_CHOOSER( m_pDialog ), mHID_SelectionChange);
-	OSL_TRACE( "after terminate, risky for some reason\n" );
-}
-
-void SalGtkFilePicker::suspendEventNotification()
-{
-	OSL_TRACE( "suspend called\n" );
-	m_aAsyncEventNotifier.suspend();
-}
-
-void SalGtkFilePicker::resumeEventNotification()
-{
-	OSL_TRACE( "resume called\n" );
-	m_aAsyncEventNotifier.resume();
-}
-    
-
 //=====================================================================
 
 struct FilterEntry
@@ -532,17 +563,19 @@
 	return m_aSubFilters.getLength();
 }
 
-static inline bool
-isFilterString( const rtl::OUString &rFilterString )
+static bool
+isFilterString( const rtl::OUString &rFilterString, char *pMatch )
 {
 		sal_Int32 nIndex = 0;
 		rtl::OUString aToken;
 		bool bIsFilter = true;
 
+        rtl::OUString aMatch(rtl::OUString::createFromAscii(pMatch));
+
 		do
 		{
 			aToken = rFilterString.getToken( 0, ';', nIndex );
-			if( !aToken.match( rtl::OUString::createFromAscii( "*." ) ) )
+			if( !aToken.match( aMatch ) )
 			{
 				bIsFilter = false;
 				break;
@@ -554,7 +587,7 @@
 }
 
 static rtl::OUString
-shrinkFilterName( const rtl::OUString &rFilterName )
+shrinkFilterName( const rtl::OUString &rFilterName, bool bAllowNoStar = false )
 {
 	int i;
 	int nBracketLen = -1;
@@ -566,21 +599,21 @@
 	{
 		if( pStr[i] == ')' )
 			nBracketEnd = i;
-
 		else if( pStr[i] == '(' )
 		{
 			nBracketLen = nBracketEnd - i;
-			if( nBracketEnd > 0 &&
-				isFilterString( rFilterName.copy( i + 1, nBracketLen - 1 ) ) )
-					aRealName = aRealName.replaceAt( i, nBracketLen + 1, rtl::OUString() );
+			if( nBracketEnd <= 0 )
+                continue;
+			if( isFilterString( rFilterName.copy( i + 1, nBracketLen - 1 ), "*." ) )
+                aRealName = aRealName.replaceAt( i, nBracketLen + 1, rtl::OUString() );
+            else if (bAllowNoStar)
+            {
+			    if( isFilterString( rFilterName.copy( i + 1, nBracketLen - 1 ), ".") )
+                    aRealName = aRealName.replaceAt( i, nBracketLen + 1, rtl::OUString() );
+            }
 		}
 	}
 
-//	OSL_TRACE( "BEFORE %s\n", 
-//		OUStringToOString( rFilterName, RTL_TEXTENCODING_UTF8 ).getStr());
-//	OSL_TRACE( "AFTER %s\n", 
-//		OUStringToOString( aRealName, RTL_TEXTENCODING_UTF8 ).getStr());
-
 	return aRealName;
 }
 
@@ -738,6 +771,20 @@
 // 
 //-----------------------------------------------------------------------------------------
 
+void SalGtkFilePicker::updateCurrentFilterFromName(const gchar* filtername)
+{
+	OUString aFilterName(filtername, strlen(filtername), RTL_TEXTENCODING_UTF8);
+	FilterList::iterator aEnd = m_pFilterList->end();
+    for (FilterList::iterator aIter = m_pFilterList->begin(); aIter != aEnd; ++aIter)
+    {
+        if (aFilterName == shrinkFilterName( aIter->getTitle()))
+        {
+            m_aCurrentFilter = aIter->getTitle();
+            break;
+        }
+    }
+}
+
 rtl::OUString SAL_CALL SalGtkFilePicker::getCurrentFilter() throw( uno::RuntimeException )
 {
 	OSL_ASSERT( m_pDialog != NULL );
@@ -747,20 +794,22 @@
 	OSL_TRACE( "GetCURRENTfilter\n" );
 
 	// Update the filtername from the users selection if they have had a chance to do so.
-	if( GtkFileFilter *filter = gtk_file_chooser_get_filter( GTK_FILE_CHOOSER( m_pDialog ) ) )
-	{
-		const gchar* filtername = gtk_file_filter_get_name( filter );
-		OUString aFilterName(filtername, strlen(filtername), RTL_TEXTENCODING_UTF8);
-		FilterList::iterator aEnd = m_pFilterList->end();
-        for (FilterList::iterator aIter = m_pFilterList->begin(); aIter != aEnd; ++aIter)
-        {
-            if (aFilterName == shrinkFilterName( aIter->getTitle()))
-            {
-		        m_aCurrentFilter = aIter->getTitle();
-                break;
-            }
-        }
-	}
+    // If the user explicitly sets a type then use that, if not then take the implicit type
+    // from the filter of the files glob on which he is currently searching
+    GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(m_pFilterView));
+    GtkTreeIter iter;
+    GtkTreeModel *model;
+    if (gtk_tree_selection_get_selected (selection, &model, &iter))
+    {
+        gchar *title;
+        gtk_tree_model_get (model, &iter, 2, &title, -1);
+        updateCurrentFilterFromName(title);
+        g_free (title);
+    }
+    else if( GtkFileFilter *filter = gtk_file_chooser_get_filter(GTK_FILE_CHOOSER(m_pDialog)))
+    {
+        updateCurrentFilterFromName(gtk_file_filter_get_name( filter ));
+    }
 
 	OSL_TRACE( "Returning current filter of %s\n", 
 		OUStringToOString( m_aCurrentFilter, RTL_TEXTENCODING_UTF8 ).getStr() );
@@ -881,23 +930,36 @@
 
 		if( GTK_FILE_CHOOSER_ACTION_SAVE == eAction )
 		{
-			const gchar* filtername = 
-				gtk_file_filter_get_name( gtk_file_chooser_get_filter( GTK_FILE_CHOOSER( m_pDialog ) ) );
+            OUString sFilterName;
 
-			OSL_TRACE( "2: current filter is %s\n", filtername );
+            GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(m_pFilterView));
+            GtkTreeIter iter;
+            GtkTreeModel *model;
+            if (gtk_tree_selection_get_selected (selection, &model, &iter))
+            {
+                gchar *title;
+                gtk_tree_model_get (model, &iter, 2, &title, -1);
+                sFilterName = OUString( title, strlen( title), RTL_TEXTENCODING_UTF8 );
+                g_free (title);
+            }
+            else
+            {
+			    const gchar* filtername = 
+				    gtk_file_filter_get_name( gtk_file_chooser_get_filter( GTK_FILE_CHOOSER( m_pDialog ) ) );
+                sFilterName = OUString( filtername, strlen( filtername ), RTL_TEXTENCODING_UTF8 );
+            }
 
+			OSL_TRACE( "2: current filter is %s\n", 
+				OUStringToOString( sFilterName, RTL_TEXTENCODING_UTF8 ).getStr() );
 
 			FilterList::iterator aListIter = ::std::find_if( 
-			       			m_pFilterList->begin(), m_pFilterList->end(), 
-						FilterTitleMatch( OUString( filtername,
-							strlen( filtername ), RTL_TEXTENCODING_UTF8 ) ) );
+                m_pFilterList->begin(), m_pFilterList->end(), FilterTitleMatch(sFilterName) );
 
 			OUString aFilter = aListIter->getFilter();
 
 			OSL_TRACE( "turned into %s\n", 
 				OUStringToOString( aFilter, RTL_TEXTENCODING_UTF8 ).getStr() );
 
-
 			sal_Int32 nTokenIndex = 0;
 			rtl::OUString sToken;
 			//   rtl::OUString strExt;
@@ -959,14 +1021,13 @@
 
 	sal_Int16 retVal = 0;
 
-	if( !startupEventNotification( STARTUP_SUSPENDED ) )
-	{
-		OSL_ENSURE( sal_False, "Could not start event notifier thread!" );
-
-		throw uno::RuntimeException( 
-			rtl::OUString::createFromAscii( "Error executing dialog" ),
-			static_cast<XFilePicker*>( this ) );
-	}
+	gulong nHID_FolderChange = 
+		g_signal_connect( GTK_FILE_CHOOSER( m_pDialog ), "current-folder-changed",
+			G_CALLBACK( folder_changed_cb ), ( gpointer )this );
+
+	gulong nHID_SelectionChange = 
+		g_signal_connect( GTK_FILE_CHOOSER( m_pDialog ), "selection-changed",
+			G_CALLBACK( selection_changed_cb ), ( gpointer )this );
 
 	SetFilters();
 
@@ -977,10 +1038,8 @@
 	{
 		btn = GTK_RESPONSE_YES; // we dont want to repeat unless user clicks NO for file save.
 
-		resumeEventNotification();
         RunDialog aRunInMain(m_pDialog);
         gint nStatus = aRunInMain.runandwaitforresult();
-		suspendEventNotification();
 		switch( nStatus )
 		{
 			case GTK_RESPONSE_ACCEPT:
@@ -995,7 +1054,8 @@
                             CResourceProvider aResProvider;
 							GtkWidget *dlg;
 			
-							dlg = gtk_message_dialog_new( GTK_WINDOW( m_pDialog ), GTK_DIALOG_MODAL,
+							dlg = gtk_message_dialog_new( NULL, 
+                                GTK_DIALOG_MODAL,
 								GTK_MESSAGE_QUESTION,
 								GTK_BUTTONS_YES_NO,
                                   OUStringToOString(
@@ -1006,8 +1066,6 @@
                                 OUStringToOString(aResProvider.getResString(FILE_PICKER_TITLE_SAVE ),
                                 RTL_TEXTENCODING_UTF8 ).getStr() );
                                  
-							gtk_dialog_set_has_separator( GTK_DIALOG( dlg ), FALSE );
-
 							btn = gtk_dialog_run( GTK_DIALOG( dlg ) );
 							gtk_widget_destroy( dlg );
 						}
@@ -1029,14 +1087,17 @@
 				break;
 		}
 	}
-	shutdownEventNotification();
+    
+	if (nHID_FolderChange)
+		g_signal_handler_disconnect(GTK_FILE_CHOOSER( m_pDialog ), nHID_FolderChange);
+	if (nHID_SelectionChange)
+		g_signal_handler_disconnect(GTK_FILE_CHOOSER( m_pDialog ), nHID_SelectionChange);
+    
 	return retVal;
 }
 
 //------------------------------------------------------------------------------------
 
-
-
 // cf. offapi/com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.idl
 GtkWidget *SalGtkFilePicker::getWidget( sal_Int16 nControlId, GType *pType )
 {
@@ -1405,16 +1466,45 @@
 	// TODO m_pImpl->setImage( aImageFormat, aImage );
 }
 
-void SalGtkFilePicker::filter_changed_cb( GtkFileChooser *file_chooser, GParamSpec *pspec, 
-	SalGtkFilePicker *pobjFP )
+void SalGtkFilePicker::implChangeType( GtkTreeSelection *selection )
 {
+    CResourceProvider aResProvider;
+    OUString aLabel = aResProvider.getResString( FILE_PICKER_FILE_TYPE );
+    GtkTreeIter iter;
+    GtkTreeModel *model;
+    if (gtk_tree_selection_get_selected (selection, &model, &iter))
+    {
+        gchar *title;
+        gtk_tree_model_get (model, &iter, 2, &title, -1);
+        aLabel += rtl::OUString::createFromAscii( ": " );
+        aLabel += rtl::OUString( title, strlen(title), RTL_TEXTENCODING_UTF8 );
+        g_free (title);
+    }
+    gtk_expander_set_label (GTK_EXPANDER (m_pFilterExpander),
+        OUStringToOString( aLabel, RTL_TEXTENCODING_UTF8 ).getStr());
 	FilePickerEvent evt;
 	evt.ElementId = LISTBOX_FILTER;
-	OSL_TRACE( "filter_changed, isn't it great %x\n", pobjFP );
-	pobjFP->controlStateChanged( evt );
+	controlStateChanged( evt );
+}
+
+void SalGtkFilePicker::type_changed_cb( GtkTreeSelection *selection, SalGtkFilePicker *pobjFP )
+{
+    pobjFP->implChangeType(selection);
 }
 
-void SalGtkFilePicker::filter_changed_atsave_cb( GtkComboBox *widget, SalGtkFilePicker *pobjFP )
+void SalGtkFilePicker::unselect_type()
+{
+    gtk_tree_selection_unselect_all(gtk_tree_view_get_selection(GTK_TREE_VIEW(m_pFilterView)));
+}
+
+void SalGtkFilePicker::expander_changed_cb( GtkExpander *expander, SalGtkFilePicker *pobjFP )
+{
+    if (gtk_expander_get_expanded(expander))
+        pobjFP->unselect_type();
+}
+
+void SalGtkFilePicker::filter_changed_cb( GtkFileChooser *file_chooser, GParamSpec *pspec, 
+	SalGtkFilePicker *pobjFP )
 {
 	FilePickerEvent evt;
 	evt.ElementId = LISTBOX_FILTER;
@@ -1465,10 +1555,8 @@
 
 	if( filename )
 		g_free( filename );
-
 }
 
-
 sal_Bool SAL_CALL SalGtkFilePicker::setShowState( sal_Bool bShowState ) throw( uno::RuntimeException )
 {
 	OSL_ASSERT( m_pDialog != NULL );
@@ -1480,29 +1568,18 @@
 		if( bShowState )
 		{
 			// Show
-			if( !mHID_Preview )
-			{
-				// This is the first time
-				m_pPreview = gtk_image_new();
-				gtk_file_chooser_set_preview_widget(
-					GTK_FILE_CHOOSER( m_pDialog ), m_pPreview );
-				mHID_Preview = g_signal_connect(
-						GTK_FILE_CHOOSER( m_pDialog ), "update-preview",
-						G_CALLBACK( update_preview_cb ), ( gpointer )this );
-			}
-			else
-			{
-				gtk_widget_show( m_pPreview );
-			}
-
+            if( !mHID_Preview )
+            {
+                mHID_Preview = g_signal_connect(
+                    GTK_FILE_CHOOSER( m_pDialog ), "update-preview",
+                    G_CALLBACK( update_preview_cb ), ( gpointer )this );
+            }
+			gtk_widget_show( m_pPreview );
 		}
 		else
 		{
 			// Hide
 			gtk_widget_hide( m_pPreview );
-
-			if( m_pPreview )
-				gtk_widget_hide( m_pPreview );
 		}
 
 		// also emit the signal
@@ -1522,7 +1599,6 @@
 	return mbPreviewState;
 }
 
-
 //------------------------------------------------------------------------------------
 // XInitialization
 //------------------------------------------------------------------------------------
@@ -1783,7 +1859,7 @@
     return bRetval;
 }
 
-void SalGtkFilePicker::implAddFilter( const OUString& rFilter, const OUString& rType )
+int SalGtkFilePicker::implAddFilter( const OUString& rFilter, const OUString& rType )
 {
 	GtkFileFilter *filter = gtk_file_filter_new();
 
@@ -1792,8 +1868,10 @@
 	gtk_file_filter_set_name( filter, aFilterName );
 
     static const OUString aStarDot = OUString::createFromAscii( "*." );
+    OUString aTokens;
 
-	if( !rType.compareToAscii( "*.*" ) )
+	bool bAllGlob = !rType.compareToAscii( "*.*" );
+	if (bAllGlob)
 		gtk_file_filter_add_pattern( filter, "*" );
 	else
 	{
@@ -1806,10 +1884,15 @@
             aToken = aToken.copy( aToken.lastIndexOf( aStarDot ) + 2 );
 			if (aToken.getLength())
             {
+                if (aTokens.getLength())
+                    aTokens += OUString::createFromAscii(",");
+                aTokens = aTokens += aToken;
                 gtk_file_filter_add_custom (filter, GTK_FILE_FILTER_FILENAME,
                     case_insensitive_filter, 
                     g_strdup( rtl::OUStringToOString( aToken, RTL_TEXTENCODING_UTF8 ) ),
                     (GDestroyNotify) g_free );
+
+	            OSL_TRACE( "fustering with %s\n", rtl::OUStringToOString( aToken, RTL_TEXTENCODING_UTF8 ).getStr());
             }
 #ifdef DEBUG
             else
@@ -1824,24 +1907,41 @@
 	}
 
 	gtk_file_chooser_add_filter( GTK_FILE_CHOOSER( m_pDialog ), filter );
+
+    int nAdded = 0;
+    if (!bAllGlob)
+    {
+        GtkTreeIter iter;
+        gtk_list_store_append (m_pFilterStore, &iter);
+        gtk_list_store_set (m_pFilterStore, &iter,
+            0, OUStringToOString(shrinkFilterName( rFilter, true ), RTL_TEXTENCODING_UTF8).getStr(),
+            1, OUStringToOString(aTokens, RTL_TEXTENCODING_UTF8).getStr(),
+            2, aFilterName.getStr(),
+            3, OUStringToOString(rType, RTL_TEXTENCODING_UTF8).getStr(),
+            -1);
+        nAdded = 1;
+    }
+    return nAdded;
 }
 
-void SalGtkFilePicker::implAddFilterGroup( const OUString& _rFilter, const Sequence< StringPair >& _rFilters )
+int SalGtkFilePicker::implAddFilterGroup( const OUString& _rFilter, const Sequence< StringPair >& _rFilters )
 {
 	// Gtk+ has no filter group concept I think so ...
 	// implAddFilter( _rFilter, String() );
+    int nAdded = 0;
 	const StringPair* pSubFilters	= _rFilters.getConstArray();
 	const StringPair* pSubFiltersEnd = pSubFilters + _rFilters.getLength();
 	for( ; pSubFilters != pSubFiltersEnd; ++pSubFilters )
-		implAddFilter( pSubFilters->First, pSubFilters->Second );
+		nAdded += implAddFilter( pSubFilters->First, pSubFilters->Second );
+    return nAdded;
 }
 
 void SalGtkFilePicker::SetFilters()
 {
 	OSL_TRACE( "start setting filters\n");
+    int nAdded = 0;
 	if( m_pFilterList && !m_pFilterList->empty() )
 	{
-
 		for	(	FilterList::iterator aListIter = m_pFilterList->begin();
 				aListIter != m_pFilterList->end();
 				++aListIter
@@ -1853,17 +1953,21 @@
 				UnoFilterList aSubFilters;
 				aListIter->getSubFilters( aSubFilters );
 
-				implAddFilterGroup( aListIter->getTitle(), aSubFilters );
+				nAdded += implAddFilterGroup( aListIter->getTitle(), aSubFilters );
 			}
 			else
 			{
 				// it's a single filter
 
-				implAddFilter( aListIter->getTitle(), aListIter->getFilter() );
+				nAdded += implAddFilter( aListIter->getTitle(), aListIter->getFilter() );
 			}
 		}
 	}
 
+    if (nAdded)
+        gtk_widget_show( m_pFilterExpander );
+    else
+        gtk_widget_hide( m_pFilterExpander );
 
 	// set the default filter
 	if( m_aCurrentFilter && (m_aCurrentFilter.getLength() > 0) )
Index: source/unx/gnome/SalGtkFilePicker.hxx
===================================================================
RCS file: /cvs/gsl/fpicker/source/unx/gnome/SalGtkFilePicker.hxx,v
retrieving revision 1.4
retrieving revision 1.4.8.4
diff -u -r1.4 -r1.4.8.4
--- openoffice.org.orig/fpicker/source/unx/gnome/SalGtkFilePicker.hxx	3 May 2005 13:47:48 -0000	1.4
+++ openoffice.org/fpicker/source/unx/gnome/SalGtkFilePicker.hxx	11 Jul 2005 14:01:34 -0000	1.4.8.4
@@ -102,10 +102,6 @@
 #include "SalGtkPicker.hxx"
 #endif
 
-#ifndef _ASYNCEVENTNOTIFIER_HXX_
-#include "asynceventnotifier.hxx"
-#endif
-
 #include <memory>
 
 #ifndef _RTL_USTRING_H_
@@ -302,11 +298,6 @@
 		void SAL_CALL controlStateChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent );
 		void SAL_CALL dialogSizeChanged( );
 
-		bool startupEventNotification(bool bStartupSuspended);
-		void shutdownEventNotification();
-		void suspendEventNotification();
-		void resumeEventNotification();
-    
 	private:
 		// prevent copy and assignment
 		SalGtkFilePicker( const SalGtkFilePicker& );           
@@ -321,10 +312,15 @@
 		::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceMgr;
 
 	private:
-		SalGtkAsyncEventNotifier m_aAsyncEventNotifier;
+        ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener >
+            m_xListener;
 		FilterList *m_pFilterList;
 		GtkWidget  *m_pVBox;
 
+        GtkWidget  *m_pFilterExpander;
+        GtkWidget  *m_pFilterView;
+        GtkListStore *m_pFilterStore;
+
 		enum { 
 			AUTOEXTENSION,
 			PASSWORD,
@@ -369,30 +365,34 @@
 		void SetCurFilter( const OUString& rFilter );
 		void SetFilters();
 
-		void implAddFilter( const OUString& rFilter, const OUString& rType);
-		void implAddFilterGroup( const OUString& rFilter, 
+        void implChangeType( GtkTreeSelection *selection );
+		int implAddFilter( const OUString& rFilter, const OUString& rType);
+		int implAddFilterGroup( const OUString& rFilter, 
 					 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair>& _rFilters );
+        void updateCurrentFilterFromName(const gchar* filtername);
+        void unselect_type();
 
         bool bVersionWidthUnset;
 		sal_Bool mbPreviewState;
-		gulong mHID_Preview;
-		gulong mHID_FolderChange;
-		gulong mHID_SelectionChange;
+        gulong mHID_Preview;
 		GtkWidget* m_pPreview;
 		sal_Int32 m_PreviewImageWidth;
 		sal_Int32 m_PreviewImageHeight;
 
+        void InitialMapping();
+
 		void HandleSetListValue(GtkComboBox *pWidget, sal_Int16 nControlAction, 
             const ::com::sun::star::uno::Any& rValue);
 		::com::sun::star::uno::Any HandleGetListValue(GtkComboBox *pWidget, sal_Int16 nControlAction) const;
 
+        static void expander_changed_cb( GtkExpander *expander, SalGtkFilePicker *pobjFP );
 		static void preview_toggled_cb (GtkObject *cb, SalGtkFilePicker *pobjFP);
 		static void filter_changed_cb (GtkFileChooser *file_chooser, GParamSpec *pspec, SalGtkFilePicker *pobjFP);
-        static void filter_changed_atsave_cb (GtkComboBox* widget, SalGtkFilePicker *pobjFP);
+        static void type_changed_cb( GtkTreeSelection *selection, SalGtkFilePicker *pobjFP );
 		static void folder_changed_cb (GtkFileChooser *file_chooser, SalGtkFilePicker *pobjFP);
 		static void selection_changed_cb (GtkFileChooser *file_chooser, SalGtkFilePicker *pobjFP);
 		static void update_preview_cb (GtkFileChooser *file_chooser, SalGtkFilePicker *pobjFP);
-
+        static void dialog_mapped_cb(GtkWidget *widget, SalGtkFilePicker *pobjFP);
 	public: 
 		 virtual ~SalGtkFilePicker();
 
Index: source/unx/gnome/SalGtkPicker.cxx
===================================================================
RCS file: /cvs/gsl/fpicker/source/unx/gnome/SalGtkPicker.cxx,v
retrieving revision 1.6
retrieving revision 1.6.8.2
diff -u -r1.6 -r1.6.8.2
--- openoffice.org.orig/fpicker/source/unx/gnome/SalGtkPicker.cxx	3 May 2005 13:48:23 -0000	1.6
+++ openoffice.org/fpicker/source/unx/gnome/SalGtkPicker.cxx	11 Jul 2005 09:40:50 -0000	1.6.8.2
@@ -113,7 +113,7 @@
     {
         gchar *pEncodedFileName = g_filename_from_uri(pIn, NULL, NULL);
         rtl::OUString sEncoded(pEncodedFileName, strlen(pEncodedFileName), osl_getThreadTextEncoding());
-	INetURLObject aCurrentURL(OUString::createFromAscii("file:///") + sEncoded);
+	INetURLObject aCurrentURL(OUString::createFromAscii("file://") + sEncoded);
 	aCurrentURL.SetHost(aURL.GetHost());
 	sURL = aCurrentURL.getExternalURL();
     }
@@ -141,17 +141,26 @@
 void RunDialog::run() 
 { 
     mnStatus = gtk_dialog_run( GTK_DIALOG( m_pDialog ) ); 
-	gtk_widget_hide( m_pDialog );
-    bFinished = true;
+    gtk_widget_hide( m_pDialog );
+
+    maLock.acquire();
+    mbFinished = true;
+    maLock.release();
+
+    Application::EndYield();
 }
 
 gint RunDialog::runandwaitforresult() 
 { 
     g_timeout_add_full(G_PRIORITY_HIGH_IDLE, 0, (GSourceFunc)rundialog, this, NULL);
-    do {
+    while (1)
+    {
+	maLock.acquire();
+    	if (mbFinished)
+            break;
+	maLock.release();
         Application::Yield();
     }
-    while (!bFinished);
     return mnStatus; 
 }
 
Index: source/unx/gnome/SalGtkPicker.hxx
===================================================================
RCS file: /cvs/gsl/fpicker/source/unx/gnome/SalGtkPicker.hxx,v
retrieving revision 1.4
retrieving revision 1.4.8.1
diff -u -r1.4 -r1.4.8.1
--- openoffice.org.orig/fpicker/source/unx/gnome/SalGtkPicker.hxx	3 May 2005 13:48:40 -0000	1.4
+++ openoffice.org/fpicker/source/unx/gnome/SalGtkPicker.hxx	1 Jun 2005 11:05:22 -0000	1.4.8.1
@@ -117,12 +117,13 @@
 class RunDialog
 {
 private:
-    bool bFinished;
+    bool mbFinished;
+    osl::Mutex maLock;
     gint mnStatus;
     GtkWidget *m_pDialog;
 public:
     void run();
-    RunDialog(GtkWidget *pDialog) : bFinished(false), m_pDialog(pDialog) { }
+    RunDialog(GtkWidget *pDialog) : mbFinished(false), m_pDialog(pDialog) { }
     gint runandwaitforresult();
 };
 
Index: source/unx/gnome/makefile.mk
===================================================================
RCS file: /cvs/gsl/fpicker/source/unx/gnome/makefile.mk,v
retrieving revision 1.4
retrieving revision 1.4.14.1
diff -u -r1.4 -r1.4.14.1
--- openoffice.org.orig/fpicker/source/unx/gnome/makefile.mk	13 Apr 2005 08:57:09 -0000	1.4
+++ openoffice.org/fpicker/source/unx/gnome/makefile.mk	1 Jun 2005 11:05:44 -0000	1.4.14.1
@@ -104,8 +104,6 @@
 		$(SLO)$/SalGtkFilePicker.obj			\
 		$(SLO)$/SalGtkFolderPicker.obj			\
 		$(SLO)$/resourceprovider.obj			\
-        $(SLO)$/asynceventnotifier.obj          \
-        $(SLO)$/filepickereventnotification.obj \
 		$(SLO)$/FPentry.obj
 
 SHL1NOCHECK=TRUE


Index: openoffice.org.spec
===================================================================
RCS file: /cvs/dist/rpms/openoffice.org/devel/openoffice.org.spec,v
retrieving revision 1.294
retrieving revision 1.295
diff -u -r1.294 -r1.295
--- openoffice.org.spec	11 Jul 2005 08:19:39 -0000	1.294
+++ openoffice.org.spec	11 Jul 2005 14:18:29 -0000	1.295
@@ -1,5 +1,5 @@
 %define ooo2ver 116
-%define ooo_rpm_release 2.cmc
+%define ooo_rpm_release 2.cmc2
 %define build_fc4 0
 %define build_fc5 1
 
@@ -95,7 +95,7 @@
 Patch27: openoffice.org-1.9.99.gcc19870.gcjaccessproblem.wizards.patch
 Patch28: openoffice.org-1.9.104-use-fontconfig-everywhere.patch
 Patch29: openoffice.org-1.9.104-berkeleydb-jni-casting-misuse.patch
-Patch30: workspace-fpicker4.patch
+Patch30: workspace.fpicker4.patch
 Patch31: openoffice.org-1.9.106.ooo44627.sal.brokencondition.patch
 Patch32: openoffice.org-1.9.106.ooo50172.icu.tamilvowelslikepango.patch
 Patch33: workspace.vcl39.patch
@@ -125,6 +125,7 @@
 Patch57: openoffice.org-1.9.115.ooo51755.scp2.parallel.patch
 Patch58: openoffice.org-1.9.116.ooo51774.rsc.parallel.patch
 Patch59: openoffice.org-1.9.116.oooXXXXX.extensions.evolution.patch
+Patch60: openoffice.org-1.9.116.rhXXXXX.desktop.noexpand.patch
 
 %define instdir %{_libdir}/openoffice.org2.0
 
@@ -734,7 +735,7 @@
 %patch27 -p1 -b .gcc19870.gcjaccessproblem.wizards.patch
 %patch28 -p1 -b .use-fontconfig-everwhere.patch
 %patch29 -p1 -b .berkeleydb-jni-casting-misuse.patch
-%patch30 -p1 -b .workspace-fpicker4.patch
+%patch30 -p1 -b .workspace.fpicker4.patch
 %patch31 -p1 -b .ooo44627.sal.brokencondition.patch
 %patch32 -p1 -b .ooo50172.icu.tamilvowelslikepango.patch
 %patch33 -p1 -b .workspace.vcl39.patch
@@ -764,6 +765,7 @@
 %patch57 -p1 -b .ooo51755.scp2.parallel.patch
 %patch58 -p1 -b .ooo51774.rsc.parallel.patch
 %patch59 -p1 -b .oooXXXXX.extensions.evolution.patch
+%patch60 -p1 -b .rhXXXXX.desktop.noexpand.patch
 #start ludicrous workaround
 #while we include these libs we need this, if/when we move to system
 #libxmlsec/db4 then this needs to be modified/dropped
@@ -2945,9 +2947,10 @@
 %{instdir}/share/registry/modules/org/openoffice/Office/Scripting/Scripting-python.xcu
 
 %changelog
-* Mon Jul 11 2005 Caolan McNamara <caolanm redhat com> - 1:1.9.116-2.cmc
+* Mon Jul 11 2005 Caolan McNamara <caolanm redhat com> - 1:1.9.116-2.cmc2
 - enable evo addressbook in addressbook wizard
 - rh#162875# extra leading / from file picker
+- update fpicker stuff
 
 * Mon Jul 11 2005 Caolan McNamara <caolanm redhat com> - 1:1.9.116-2
 - add openoffice.org-1.9.116.ooo51774.rsc.parallel.patch


--- workspace-fpicker4.patch DELETED ---


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]