diff options
author | Pratik V. Parikh <pratikvp@despammed.com> | 2004-03-09 00:58:41 +0800 |
---|---|---|
committer | Rodney Dawes <dobey@src.gnome.org> | 2004-03-09 00:58:41 +0800 |
commit | b866d48f553b9aa7cdbe3200763d4bfc3017c943 (patch) | |
tree | a2ad8d8ad101dd0fba458a5ca6f12e7e7d82daac /shell | |
parent | 995e51439d91d1ac12f05c099f0b624f02773542 (diff) | |
download | gsoc2013-evolution-b866d48f553b9aa7cdbe3200763d4bfc3017c943.tar gsoc2013-evolution-b866d48f553b9aa7cdbe3200763d4bfc3017c943.tar.gz gsoc2013-evolution-b866d48f553b9aa7cdbe3200763d4bfc3017c943.tar.bz2 gsoc2013-evolution-b866d48f553b9aa7cdbe3200763d4bfc3017c943.tar.lz gsoc2013-evolution-b866d48f553b9aa7cdbe3200763d4bfc3017c943.tar.xz gsoc2013-evolution-b866d48f553b9aa7cdbe3200763d4bfc3017c943.tar.zst gsoc2013-evolution-b866d48f553b9aa7cdbe3200763d4bfc3017c943.zip |
Check that app is not NULL before trying to open the quickref document.
2004-03-06 Pratik V. Parikh <pratikvp@despammed.com>
* e-shell-window-commands.c (command_quick_reference): Check that
app is not NULL before trying to open the quickref document.
Fixes #55106
svn path=/trunk/; revision=24989
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ChangeLog | 7 | ||||
-rw-r--r-- | shell/e-shell-window-commands.c | 51 |
2 files changed, 33 insertions, 25 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index c6320aaa32..d5745789e8 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,10 @@ +2004-03-06 Pratik V. Parikh <pratikvp@despammed.com> + + * e-shell-window-commands.c (command_quick_reference): Check that + app is not NULL before trying to open the quickref document. + + Fixes #55106 + 2004-02-15 Rodney Dawes <dobey@ximian.com> * evolution-nognome.in: Use @BASE_VERSION@ for the binary 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); } } |