From 3284b5f24aaa92360f09cffb28be6a26e5f8ba86 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Wed, 23 Feb 2005 07:01:27 +0000 Subject: Use gnome-vfs API to open quick reference in the pdf viewer 2005-02-22 Marco Pesenti Gritti * shell/e-shell-window-commands.c: (command_quick_reference): Use gnome-vfs API to open quick reference in the pdf viewer svn path=/trunk/; revision=28863 --- shell/ChangeLog | 5 +++++ shell/e-shell-window-commands.c | 37 ++++++++++++------------------------- 2 files changed, 17 insertions(+), 25 deletions(-) diff --git a/shell/ChangeLog b/shell/ChangeLog index 35d58a721d..e63e0331a2 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,8 @@ +2005-02-22 Marco Pesenti Gritti + + * shell/e-shell-window-commands.c: (command_quick_reference): + Use gnome-vfs API to open quick reference in the pdf viewer + 2005-02-22 William Jon McCann * e-shell-window.c (setup_offline_toggle): Make offline button scale diff --git a/shell/e-shell-window-commands.c b/shell/e-shell-window-commands.c index c6a7ded294..438e5c50cd 100644 --- a/shell/e-shell-window-commands.c +++ b/shell/e-shell-window-commands.c @@ -44,6 +44,7 @@ #include #include +#include #include @@ -486,9 +487,6 @@ command_quick_reference (BonoboUIComponent *uih, const char *path) { char *quickref; - char *uri; - char *command; - GString *str; GnomeVFSMimeApplication *app; const GList *lang_list = gnome_i18n_get_language_list ("LC_MESSAGES"); @@ -504,29 +502,18 @@ command_quick_reference (BonoboUIComponent *uih, quickref = g_build_filename (EVOLUTION_HELPDIR, "quickref", lang, "quickref.pdf", NULL); if (g_file_test (quickref, G_FILE_TEST_EXISTS)) { app = gnome_vfs_mime_get_default_application ("application/pdf"); + if (app) { - str = g_string_new (""); - str = g_string_append (str, app->command); - - switch (app->expects_uris) { - case GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS: - uri = g_strconcat ("file://", quickref, NULL); - g_string_append_printf (str, " %s", uri); - g_free (uri); - break; - case GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_PATHS: - case GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS_FOR_NON_FILES: - g_string_append_printf (str, " %s", quickref); - break; - } - - command = g_string_free (str, FALSE); - if (command != NULL && - !g_spawn_command_line_async (command, NULL)) { - g_warning ("Could not launch %s", command); - } - - g_free (command); + GList *uris = NULL; + char *uri; + + uri = gnome_vfs_get_uri_from_local_path (quickref); + uris = g_list_append (uris, uri); + + gnome_vfs_mime_application_launch (app, uris); + + g_free (uri); + g_list_free (uris); gnome_vfs_mime_application_free (app); } -- cgit v1.2.3