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:
Hiroyuki Ikezoe 2011-05-12 20:55:00 -07:00
Родитель 7dc9da1e17
Коммит 29dc2eff25
2 изменённых файлов: 7 добавлений и 23 удалений

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

@ -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;