зеркало из https://github.com/mozilla/gecko-dev.git
Bug 656781 - More efficient way to use g_app_info_launch_uris and gnome_vfs_mime_application_launch, r=karlt
--HG-- extra : rebase_source : a97c1bdaf1b45d380c3b90d9abb2507c68ab5128
This commit is contained in:
Родитель
7dc9da1e17
Коммит
29dc2eff25
|
@ -135,22 +135,12 @@ nsGIOMimeApp::GetExpectsURIs(PRInt32* aExpects)
|
|||
NS_IMETHODIMP
|
||||
nsGIOMimeApp::Launch(const nsACString& aUri)
|
||||
{
|
||||
char *uri = strdup(PromiseFlatCString(aUri).get());
|
||||
GList uris = { 0 };
|
||||
PromiseFlatCString flatUri(aUri);
|
||||
uris.data = const_cast<char*>(flatUri.get());
|
||||
|
||||
if (!uri)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
GList *uris = g_list_append(NULL, uri);
|
||||
|
||||
if (!uris) {
|
||||
g_free(uri);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
GError *error = NULL;
|
||||
gboolean result = g_app_info_launch_uris(mApp, uris, NULL, &error);
|
||||
|
||||
g_free(uri);
|
||||
g_list_free(uris);
|
||||
gboolean result = g_app_info_launch_uris(mApp, &uris, NULL, &error);
|
||||
|
||||
if (!result) {
|
||||
g_warning("Cannot launch application: %s", error->message);
|
||||
|
|
|
@ -107,17 +107,11 @@ nsGnomeVFSMimeApp::Launch(const nsACString &aUri)
|
|||
if (! uri)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
GList *uris = g_list_append(NULL, uri);
|
||||
GList uris = { 0 };
|
||||
uris.data = uri;
|
||||
|
||||
if (! uris) {
|
||||
GnomeVFSResult result = gnome_vfs_mime_application_launch(mApp, &uris);
|
||||
g_free(uri);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
GnomeVFSResult result = gnome_vfs_mime_application_launch(mApp, uris);
|
||||
|
||||
g_free(uri);
|
||||
g_list_free(uris);
|
||||
|
||||
if (result != GNOME_VFS_OK)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
Загрузка…
Ссылка в новой задаче