aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-06-13 09:45:52 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-06-13 11:59:57 +0800
commit477736ea33b961f72a583f320632fd12c411b164 (patch)
tree301dbcd3bb81cbddcc23edc1e4de88e2ee7a507f /widgets
parent4bd31414798facc1b57b744fa7924ce8e8a9b8e4 (diff)
downloadgsoc2013-evolution-477736ea33b961f72a583f320632fd12c411b164.tar
gsoc2013-evolution-477736ea33b961f72a583f320632fd12c411b164.tar.gz
gsoc2013-evolution-477736ea33b961f72a583f320632fd12c411b164.tar.bz2
gsoc2013-evolution-477736ea33b961f72a583f320632fd12c411b164.tar.lz
gsoc2013-evolution-477736ea33b961f72a583f320632fd12c411b164.tar.xz
gsoc2013-evolution-477736ea33b961f72a583f320632fd12c411b164.tar.zst
gsoc2013-evolution-477736ea33b961f72a583f320632fd12c411b164.zip
Bug 585554 – Opening PDF attachment crashes in e_attachment_open_handle_error()
Diffstat (limited to 'widgets')
-rw-r--r--widgets/misc/e-attachment.c47
1 files changed, 17 insertions, 30 deletions
diff --git a/widgets/misc/e-attachment.c b/widgets/misc/e-attachment.c
index ba2811d5d9..7735be8872 100644
--- a/widgets/misc/e-attachment.c
+++ b/widgets/misc/e-attachment.c
@@ -1957,7 +1957,6 @@ attachment_open_file (GFile *file,
{
GdkAppLaunchContext *context;
GSimpleAsyncResult *simple;
- GList *file_list;
gboolean success;
GError *error = NULL;
@@ -1965,41 +1964,29 @@ attachment_open_file (GFile *file,
simple = open_context->simple;
open_context->simple = NULL;
- /* Find a default app based on content type. */
- if (open_context->app_info == NULL) {
- EAttachment *attachment;
- GFileInfo *file_info;
- const gchar *content_type;
-
- attachment = open_context->attachment;
- file_info = e_attachment_get_file_info (attachment);
- if (file_info == NULL)
- goto exit;
-
- content_type = g_file_info_get_content_type (file_info);
- if (content_type == NULL)
- goto exit;
+ context = gdk_app_launch_context_new ();
- open_context->app_info = g_app_info_get_default_for_type (
- content_type, FALSE);
+ if (open_context->app_info != NULL) {
+ GList *file_list;
+
+ file_list = g_list_prepend (NULL, file);
+ success = g_app_info_launch (
+ open_context->app_info, file_list,
+ G_APP_LAUNCH_CONTEXT (context), &error);
+ g_list_free (file_list);
+ } else {
+ gchar *uri;
+
+ uri = g_file_get_uri (file);
+ success = g_app_info_launch_default_for_uri (
+ uri, G_APP_LAUNCH_CONTEXT (context), &error);
+ g_free (uri);
}
- if (open_context->app_info == NULL)
- goto exit;
-
- context = gdk_app_launch_context_new ();
- file_list = g_list_prepend (NULL, file);
-
- success = g_app_info_launch (
- open_context->app_info, file_list,
- G_APP_LAUNCH_CONTEXT (context), &error);
+ g_object_unref (context);
g_simple_async_result_set_op_res_gboolean (simple, success);
- g_list_free (file_list);
- g_object_unref (context);
-
-exit:
if (error != NULL) {
g_simple_async_result_set_from_error (simple, error);
g_error_free (error);