diff options
author | trav90 <travawine@protonmail.ch> | 2015-04-30 03:53:27 -0500 |
---|---|---|
committer | trav90 <travawine@protonmail.ch> | 2015-04-30 03:53:27 -0500 |
commit | 40e3315e7f3fed6937ab41a2f413ddbc1b14e7e3 (patch) | |
tree | 9db78d1b86bed9a8f75006d9216373dadb3a59a6 /toolkit | |
parent | a2dab96992377500746058f40e5e463d3384d3a0 (diff) | |
download | palemoon-gre-40e3315e7f3fed6937ab41a2f413ddbc1b14e7e3.tar.gz |
Remove nsGnomeVFSService
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/system/gnome/moz.build | 5 | ||||
-rw-r--r-- | toolkit/system/gnome/nsGnomeModule.cpp | 13 | ||||
-rw-r--r-- | toolkit/system/gnome/nsGnomeVFSService.cpp | 224 |
3 files changed, 0 insertions, 242 deletions
diff --git a/toolkit/system/gnome/moz.build b/toolkit/system/gnome/moz.build index b535a9804..e9db84aae 100644 --- a/toolkit/system/gnome/moz.build +++ b/toolkit/system/gnome/moz.build @@ -15,11 +15,6 @@ if CONFIG['MOZ_ENABLE_GCONF']: 'nsGConfService.cpp', ] -if CONFIG['MOZ_ENABLE_GNOMEVFS']: - CPP_SOURCES += [ - 'nsGnomeVFSService.cpp', - ] - if CONFIG['MOZ_ENABLE_GIO']: CPP_SOURCES += [ 'nsGIOService.cpp', diff --git a/toolkit/system/gnome/nsGnomeModule.cpp b/toolkit/system/gnome/nsGnomeModule.cpp index 4d240c3b9..98d07fa37 100644 --- a/toolkit/system/gnome/nsGnomeModule.cpp +++ b/toolkit/system/gnome/nsGnomeModule.cpp @@ -12,10 +12,6 @@ #include "nsGConfService.h" NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGConfService, Init) #endif -#ifdef MOZ_ENABLE_GNOMEVFS -#include "nsGnomeVFSService.h" -NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGnomeVFSService, Init) -#endif #ifdef MOZ_ENABLE_GIO #include "nsGIOService.h" #include "nsGSettingsService.h" @@ -26,9 +22,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGSettingsService, Init) #ifdef MOZ_ENABLE_GCONF NS_DEFINE_NAMED_CID(NS_GCONFSERVICE_CID); #endif -#ifdef MOZ_ENABLE_GNOMEVFS -NS_DEFINE_NAMED_CID(NS_GNOMEVFSSERVICE_CID); -#endif #ifdef MOZ_ENABLE_GIO NS_DEFINE_NAMED_CID(NS_GIOSERVICE_CID); NS_DEFINE_NAMED_CID(NS_GSETTINGSSERVICE_CID); @@ -38,9 +31,6 @@ static const mozilla::Module::CIDEntry kGnomeCIDs[] = { #ifdef MOZ_ENABLE_GCONF { &kNS_GCONFSERVICE_CID, false, NULL, nsGConfServiceConstructor }, #endif -#ifdef MOZ_ENABLE_GNOMEVFS - { &kNS_GNOMEVFSSERVICE_CID, false, NULL, nsGnomeVFSServiceConstructor }, -#endif #ifdef MOZ_ENABLE_GIO { &kNS_GIOSERVICE_CID, false, NULL, nsGIOServiceConstructor }, { &kNS_GSETTINGSSERVICE_CID, false, NULL, nsGSettingsServiceConstructor }, @@ -52,9 +42,6 @@ static const mozilla::Module::ContractIDEntry kGnomeContracts[] = { #ifdef MOZ_ENABLE_GCONF { NS_GCONFSERVICE_CONTRACTID, &kNS_GCONFSERVICE_CID }, #endif -#ifdef MOZ_ENABLE_GNOMEVFS - { NS_GNOMEVFSSERVICE_CONTRACTID, &kNS_GNOMEVFSSERVICE_CID }, -#endif #ifdef MOZ_ENABLE_GIO { NS_GIOSERVICE_CONTRACTID, &kNS_GIOSERVICE_CID }, { NS_GSETTINGSSERVICE_CONTRACTID, &kNS_GSETTINGSSERVICE_CID }, diff --git a/toolkit/system/gnome/nsGnomeVFSService.cpp b/toolkit/system/gnome/nsGnomeVFSService.cpp deleted file mode 100644 index 10084d1d1..000000000 --- a/toolkit/system/gnome/nsGnomeVFSService.cpp +++ /dev/null @@ -1,224 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsGnomeVFSService.h" -#include "nsStringAPI.h" -#include "nsIURI.h" -#include "nsTArray.h" -#include "nsIStringEnumerator.h" -#include "nsAutoPtr.h" - -extern "C" { -#include <libgnomevfs/gnome-vfs.h> -#include <libgnomevfs/gnome-vfs-mime.h> -#include <libgnomevfs/gnome-vfs-mime-handlers.h> -} - -class nsGnomeVFSMimeApp MOZ_FINAL : public nsIGnomeVFSMimeApp -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIGNOMEVFSMIMEAPP - - nsGnomeVFSMimeApp(GnomeVFSMimeApplication* aApp) : mApp(aApp) {} - ~nsGnomeVFSMimeApp() { gnome_vfs_mime_application_free(mApp); } - -private: - GnomeVFSMimeApplication *mApp; -}; - -NS_IMPL_ISUPPORTS1(nsGnomeVFSMimeApp, nsIGnomeVFSMimeApp) - -NS_IMETHODIMP -nsGnomeVFSMimeApp::GetId(nsACString& aId) -{ - aId.Assign(mApp->id); - return NS_OK; -} - -NS_IMETHODIMP -nsGnomeVFSMimeApp::GetName(nsACString& aName) -{ - aName.Assign(mApp->name); - return NS_OK; -} - -NS_IMETHODIMP -nsGnomeVFSMimeApp::GetCommand(nsACString& aCommand) -{ - aCommand.Assign(mApp->command); - return NS_OK; -} - -NS_IMETHODIMP -nsGnomeVFSMimeApp::GetCanOpenMultipleFiles(bool* aCanOpen) -{ - *aCanOpen = mApp->can_open_multiple_files; - return NS_OK; -} - -NS_IMETHODIMP -nsGnomeVFSMimeApp::GetExpectsURIs(int32_t* aExpects) -{ - *aExpects = mApp->expects_uris; - return NS_OK; -} - -NS_IMETHODIMP -nsGnomeVFSMimeApp::Launch(const nsACString &aUri) -{ - char *uri = gnome_vfs_make_uri_from_input(PromiseFlatCString(aUri).get()); - - if (! uri) - return NS_ERROR_FAILURE; - - GList uris = { 0 }; - uris.data = uri; - - GnomeVFSResult result = gnome_vfs_mime_application_launch(mApp, &uris); - g_free(uri); - - if (result != GNOME_VFS_OK) - return NS_ERROR_FAILURE; - - return NS_OK; -} - -class UTF8StringEnumerator MOZ_FINAL : public nsIUTF8StringEnumerator -{ -public: - UTF8StringEnumerator() : mIndex(0) { } - ~UTF8StringEnumerator() { } - - NS_DECL_ISUPPORTS - NS_DECL_NSIUTF8STRINGENUMERATOR - - nsTArray<nsCString> mStrings; - uint32_t mIndex; -}; - -NS_IMPL_ISUPPORTS1(UTF8StringEnumerator, nsIUTF8StringEnumerator) - -NS_IMETHODIMP -UTF8StringEnumerator::HasMore(bool *aResult) -{ - *aResult = mIndex < mStrings.Length(); - return NS_OK; -} - -NS_IMETHODIMP -UTF8StringEnumerator::GetNext(nsACString& aResult) -{ - if (mIndex >= mStrings.Length()) - return NS_ERROR_UNEXPECTED; - - aResult.Assign(mStrings[mIndex]); - ++mIndex; - return NS_OK; -} - -NS_IMETHODIMP -nsGnomeVFSMimeApp::GetSupportedURISchemes(nsIUTF8StringEnumerator** aSchemes) -{ - *aSchemes = nullptr; - - nsRefPtr<UTF8StringEnumerator> array = new UTF8StringEnumerator(); - NS_ENSURE_TRUE(array, NS_ERROR_OUT_OF_MEMORY); - - for (GList *list = mApp->supported_uri_schemes; list; list = list->next) { - if (!array->mStrings.AppendElement((char*) list->data)) { - return NS_ERROR_OUT_OF_MEMORY; - } - } - - NS_ADDREF(*aSchemes = array); - return NS_OK; -} - -NS_IMETHODIMP -nsGnomeVFSMimeApp::GetRequiresTerminal(bool* aRequires) -{ - *aRequires = mApp->requires_terminal; - return NS_OK; -} - -nsresult -nsGnomeVFSService::Init() -{ - return gnome_vfs_init() ? NS_OK : NS_ERROR_FAILURE; -} - -NS_IMPL_ISUPPORTS1(nsGnomeVFSService, nsIGnomeVFSService) - -NS_IMETHODIMP -nsGnomeVFSService::GetMimeTypeFromExtension(const nsACString &aExtension, - nsACString& aMimeType) -{ - nsAutoCString fileExtToUse("."); - fileExtToUse.Append(aExtension); - - const char *mimeType = gnome_vfs_mime_type_from_name(fileExtToUse.get()); - aMimeType.Assign(mimeType); - - // |mimeType| points to internal gnome-vfs data, so don't free it. - - return NS_OK; -} - -NS_IMETHODIMP -nsGnomeVFSService::GetAppForMimeType(const nsACString &aMimeType, - nsIGnomeVFSMimeApp** aApp) -{ - *aApp = nullptr; - GnomeVFSMimeApplication *app = - gnome_vfs_mime_get_default_application(PromiseFlatCString(aMimeType).get()); - - if (app) { - nsGnomeVFSMimeApp *mozApp = new nsGnomeVFSMimeApp(app); - NS_ENSURE_TRUE(mozApp, NS_ERROR_OUT_OF_MEMORY); - - NS_ADDREF(*aApp = mozApp); - } - - return NS_OK; -} - -NS_IMETHODIMP -nsGnomeVFSService::GetDescriptionForMimeType(const nsACString &aMimeType, - nsACString& aDescription) -{ - const char *desc = - gnome_vfs_mime_get_description(PromiseFlatCString(aMimeType).get()); - aDescription.Assign(desc); - - // |desc| points to internal gnome-vfs data, so don't free it. - - return NS_OK; -} - -NS_IMETHODIMP -nsGnomeVFSService::ShowURI(nsIURI *aURI) -{ - nsAutoCString spec; - aURI->GetSpec(spec); - - if (gnome_vfs_url_show_with_env(spec.get(), NULL) == GNOME_VFS_OK) - return NS_OK; - - 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_vfs_url_show_with_env(spec, NULL) == GNOME_VFS_OK) - rv = NS_OK; - - g_free(spec); - return rv; -} |