Bug 391980 - "New Download manager automatically associates all types of files including folders with one file type" [p=ventnor.bugzilla@yahoo.com.au (Michael Ventnor) r=bsmedberg a=blocking-firefox3+]

This commit is contained in:
reed@reedloden.com 2007-11-26 15:55:34 -08:00
Родитель 124c9d633d
Коммит 90f7bad0e6
3 изменённых файлов: 52 добавлений и 1 удалений

Просмотреть файл

@ -50,6 +50,7 @@ extern "C" {
#include <libgnomevfs/gnome-vfs-mime.h>
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
#include <libgnomevfs/gnome-vfs-mime-info.h>
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libgnome/gnome-url.h>
}
@ -245,6 +246,20 @@ nsGnomeVFSService::ShowURI(nsIURI *aURI)
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsGnomeVFSService::ShowURIForInput(const nsACString &aUri)
{
char* spec = gnome_vfs_make_uri_from_input(PromiseFlatCString(aUri).get());
nsresult rv = NS_ERROR_FAILURE;
if (gnome_url_show(spec, NULL))
rv = NS_OK;
if (spec)
g_free(spec);
return rv;
}
NS_IMETHODIMP
nsGnomeVFSService::SetAppStringKey(const nsACString &aID,
PRInt32 aKey,

Просмотреть файл

@ -83,6 +83,10 @@
#include "nsITimelineService.h"
#include "nsIProgrammingLanguage.h"
#ifdef MOZ_WIDGET_GTK2
#include "nsIGnomeVFSService.h"
#endif
#include "nsNativeCharsetUtils.h"
#include "nsTraceRefcntImpl.h"
@ -1663,13 +1667,44 @@ nsLocalFile::Launch()
NS_IMETHODIMP
nsLocalFile::Reveal()
{
#ifdef MOZ_WIDGET_GTK2
nsCOMPtr<nsIGnomeVFSService> vfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
if (!vfs)
return NS_ERROR_FAILURE;
PRBool isDirectory;
if (NS_FAILED(IsDirectory(&isDirectory)))
return NS_ERROR_FAILURE;
if (isDirectory) {
return vfs->ShowURIForInput(mPath);
} else {
nsCOMPtr<nsIFile> parentDir;
nsCAutoString dirPath;
if (NS_FAILED(GetParent(getter_AddRefs(parentDir))))
return NS_ERROR_FAILURE;
if (NS_FAILED(parentDir->GetNativePath(dirPath)))
return NS_ERROR_FAILURE;
return vfs->ShowURIForInput(dirPath);
}
#else
return NS_ERROR_FAILURE;
#endif
}
NS_IMETHODIMP
nsLocalFile::Launch()
{
#ifdef MOZ_WIDGET_GTK2
nsCOMPtr<nsIGnomeVFSService> vfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
if (!vfs)
return NS_ERROR_FAILURE;
return vfs->ShowURIForInput(mPath);
#else
return NS_ERROR_FAILURE;
#endif
}
#endif

Просмотреть файл

@ -44,7 +44,7 @@ interface nsIURI;
/* nsIGnomeVFSMimeApp holds information about an application that is looked up
with nsIGnomeVFSService::GetAppForMimeType. */
[scriptable, uuid(99ae024f-e869-4973-958b-54768a84295a)]
[scriptable, uuid(57b1ef41-35cd-48e9-a248-2030c8365067)]
interface nsIGnomeVFSMimeApp : nsISupports
{
const long EXPECTS_URIS = 0;
@ -143,6 +143,7 @@ interface nsIGnomeVFSService : nsISupports
/* Open the given URI in the default application */
void showURI(in nsIURI uri);
[noscript] void showURIForInput(in ACString uri);
};
%{C++