Bug 402892. Support gio as well as gnome-vfs. r=roc

This commit is contained in:
2009-08-25 11:58:11 -07:00
parent 3713a38807
commit 1092734136
14 changed files with 894 additions and 80 deletions

View File

@@ -83,6 +83,7 @@
#include "nsITimelineService.h"
#ifdef MOZ_WIDGET_GTK2
#include "nsIGIOService.h"
#include "nsIGnomeVFSService.h"
#endif
@@ -1632,8 +1633,9 @@ NS_IMETHODIMP
nsLocalFile::Reveal()
{
#ifdef MOZ_WIDGET_GTK2
nsCOMPtr<nsIGnomeVFSService> vfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
if (!vfs)
nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
nsCOMPtr<nsIGnomeVFSService> gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
if (!giovfs && !gnomevfs)
return NS_ERROR_FAILURE;
PRBool isDirectory;
@@ -1641,7 +1643,11 @@ nsLocalFile::Reveal()
return NS_ERROR_FAILURE;
if (isDirectory) {
return vfs->ShowURIForInput(mPath);
if (giovfs)
return giovfs->ShowURIForInput(mPath);
else
/* Fallback to GnomeVFS */
return gnomevfs->ShowURIForInput(mPath);
} else {
nsCOMPtr<nsIFile> parentDir;
nsCAutoString dirPath;
@@ -1650,7 +1656,10 @@ nsLocalFile::Reveal()
if (NS_FAILED(parentDir->GetNativePath(dirPath)))
return NS_ERROR_FAILURE;
return vfs->ShowURIForInput(dirPath);
if (giovfs)
return giovfs->ShowURIForInput(dirPath);
else
return gnomevfs->ShowURIForInput(dirPath);
}
#else
return NS_ERROR_FAILURE;
@@ -1679,11 +1688,16 @@ nsLocalFile::Launch()
return NS_ERROR_FAILURE;
return NS_OK;
#else
nsCOMPtr<nsIGnomeVFSService> vfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
if (!vfs)
return NS_ERROR_FAILURE;
return vfs->ShowURIForInput(mPath);
nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
nsCOMPtr<nsIGnomeVFSService> gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
if (giovfs) {
return giovfs->ShowURIForInput(mPath);
} else if (gnomevfs) {
/* GnomeVFS fallback */
return gnomevfs->ShowURIForInput(mPath);
}
return NS_ERROR_FAILURE;
#endif
#else
return NS_ERROR_FAILURE;