aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell-window-commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell/e-shell-window-commands.c')
-rw-r--r--shell/e-shell-window-commands.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/shell/e-shell-window-commands.c b/shell/e-shell-window-commands.c
index 8ce97a7940..39f6390b68 100644
--- a/shell/e-shell-window-commands.c
+++ b/shell/e-shell-window-commands.c
@@ -188,7 +188,6 @@ command_quick_reference (BonoboUIComponent *uih,
{
char *quickref;
char *uri;
- char *mimetype;
char *command;
GString *str;
GnomeVFSMimeApplication *app;
@@ -205,35 +204,37 @@ 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)) {
- mimetype = gnome_vfs_get_mime_type (quickref);
- app = gnome_vfs_mime_get_default_application (mimetype);
- 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;
+ 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);
+ gnome_vfs_mime_application_free (app);
}
- 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);
-
- gnome_vfs_mime_application_free (app);
- g_free (mimetype);
g_free (quickref);
return;
}
+
g_free (quickref);
}
}